in reply to Re: visualizing data in a table
in thread visualizing data in a table
Now, to fit the other parts of the chain together.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: visualizing data in a table
by BrowserUk (Patriarch) on Mar 27, 2010 at 06:13 UTC | |
Would be nice to have comments/annotation in that code.
The code provides a single function colorRamp1785() which takes 3 parameters:
As a user, all you need to do is supply the numeric value + minimum and maximum and use the return to draw your plot. Eg. If your minimum rainfall value is 0.5" and maximum 10", then to get the right color to plot the value 2.5",
If the drawing package you use needs discrete RGBs rather than packed, just remove the rgb2n() call from the return line. Does that help? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by punkish (Priest) on Mar 27, 2010 at 23:45 UTC | |
Does that help? Oh, absolutely! I have taken the code for colorRamp and am adapting it to my use. I have not just precip, but many different ecophysical variables, so I can use it for creating visualizations of all of them. My colorRamp itself is going to be customizable so that I will be able to specify starting and ending colors (kinda like I linked to at http://colorbrewer.org). This is truly great, and thanks and attribution goes to you, of course. By the way, if you don't mind answering -- why do you have the colorRamp definition itself inside a BEGIN {} block?
--
when small people start casting long shadows, it is time to go to bed | [reply] |
by BrowserUk (Patriarch) on Mar 28, 2010 at 01:15 UTC | |
why do you have the colorRamp definition itself inside a BEGIN {} block? Just to ensure that the lookup table is built before the sub can be called. That would take care of itself if it was in a module. But so far, everyone who's contacted me about the snippet has had a different set of requirements of it. Some want discrete rgbs; some rgba; some as html-style 3 or 6 hex digits; some want cmyk. Everyone seems to need to adapt it some way or another. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
by spx2 (Deacon) on Mar 31, 2010 at 15:01 UTC | |
I'm using it in a loop like so: $img->setPixel($x, $y, $some_val_from_a_table , 1,16 )) ; it works ok but sometime produces colours which are too near to each other to be distinguished easily. Browser_Uk , how di dyou write your colour ramp ? I read about some colour ramps <-- here, but not sure if they fit the common usage. | [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Mar 31, 2010 at 17:53 UTC | |
The idea behind the code started from here. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |