OK, I think this is probably simple but I've searched extensively and can't find anything. What I want to do is specify the precise RGB colour values of a contour line generated with matplotlib. I know that if I do something like :
plt.contour(X,Y,Z,[0.1,0.2,0.3],colors='k')
then I'll get three contour levels which are all black, or if I were to substitute 'w' in place of 'k' then the contours would all be white. That's fine, but what I need to do is something like this :
plt.contour(X,Y,Z,[0.1,0.2,0.3],colors=(1.0,0.25,0.75)
Where the colours not chosen from some in-built presets but have RGB (or RGBA) values precisely defined by me.
Any ideas ?
You should give a list with colors. If the list is 1 color long, it will use that color for all contours.
plt.contour(X, Y, Z, [0.1,0.2,0.3], colors = [(1.0,0.25,0.75)])
Related
I have three columns with RGB colors. In another set of columns, I need to convert them to X,Y coordinates per the following examples:
How?
The math is eluding me, mostly because it has to wrap back around to red.
Of note: no VB please, and I'd prefer the map jump from the second red directly to pure grayscale (i.e. no bleeding).
UPDATE: I came up with the following:
X —
=IF(AND(MAX([#R]:[#B])=[#R],MAX([#R]:[#B])<>[#B]),[#R]+[#G]-[#B],
IF(MAX([#R]:[#B])=[#G],512+[#G]+[#B]-[#R],
IF(MAX([#R]:[#B])=[#B],1024+[#B]+[#R]-[#G])))
-(256*(MAX([#R]:[#B])/256))
Y —
=ROUNDUP(MAX(Table1[#[R]:[B]])/2*IF(MIN(Table1[#[R]:[B]])=0,1,1+MIN(Table1[#[R]:[B]])/256),0)
Plus a separate quick calculation to wrap around negative X values. I'll also write a quick check for grayscale exceptions after I resolve colors.
But first, tell me why the above is wrong.
I am trying to put labels in a plot using gnuplot. For example, I need to label "Object 1" as blue:
set label 6 at 313,200 'Object 1' center rotate by 70 front tc ls 3
But 3 is not the kind of blue which I need. There are many different websites that show corresponding colors and numbers in gnuplot but for labeling the numbers of colors are not relevant to gnuplot color numbers. Where can I find the relevant different color numbers for labels?
Just, for the sake of not letting this question appear unanswered:
gnuplot has 111 predefined colors, type show colornames or see them here: predefined gnuplot colors visualized, or as Michael O. says "mix" your color red, e.g. 0xff0000 according to the scheme 0xRRGGBB. Set your textcolor with ...tc rgb 0xff0000. You even can add transparency according to the scheme 0xAARRGGBB where AA is the alpha channel, 00 is opaque, ff is fully transparent.
I'm a novice in Gnuplot. Today I was plotting a simple txt file with two data columns, being the x and y coordinates of a cloud of points in the xy plane; I wanted to color them according to the position they occupied in the list, so I should have gone for something like:
plot "data.txt" u 1:2:0 lc palette
that produces what I want:
(desired plot)
By mistake, I omitted the "using" part of the command, so that I prompted:
plot "data.txt" lc palette
Now, the points still are plotted in the correct positions, so that gnuplot is automatically interpreting them as (x,y) coordinates... but the colors look like this:
(strangely colored plot)
I find this baffling since there's the possibility that I'm involuntarily highlighting some interesting feature of my data (which, by the way, consists of few iterations of a discrete recurrence for a set - the x=1.57 line you can see - of different initial conditions.
The question is: what criterion does 'lc palette' use to assign the parity I see to my points? What is its default behavior supposed to be in this case?
Thanks in advance!
EDIT: I don't know if it can be useful, but prompting 'show palette' I get:
palette is COLOR
rgb color mapping by rgbformulae are 7,5,15
figure is POSITIVE
all color formulae ARE NOT written into output postscript file
allocating ALL remaining color positions for discrete palette terminals
Color-Model: RGB
gamma is 1.5
How can I plot (many) uncorrelated points from a data file in 3D with color corresponding to the value of one column? The color-value is non-integral.
======================================================================
details:
I have a large data file with three columns of the form
longitude latitude color
The data is scattered and uncorrelated, i.e. no underlying grid and no relationship between the points (except that every coordinate appears only once). color is an arbitrary scalar. I know the min and the max value of that, and would like to have linear scaling of the color in between. Which colormap is not clear atm, a first step would be to produce any meaningful output.
How can I plot dots on the longitude-latitude coordinates on the unit sphere (i.e. radius = 1) with the specified color?
No interpolation is wanted, not even a connection between the points. (I'm also happy for suggestions how to do that in an easy way, but it's actually not important)
This is how far I've gone, but the coloring is missing:
set mapping spherical
splot 'the_file.data' u 1:2:(1)
Thanks a bunch!
You can use linecolor palette, which allows you to specify an additional column which is used to select the respective color from the current palette:
set mapping spherical
splot 'the_file.data' using 1:2:(1):3 linecolor palette
Suppose one has a plot like this, for which the peak is at (x,y) = (0,0.40). The distribution is plotted in blue. Is it possible to edit the color scheme of the distribution plot in such a way that the color is a gradient - the farther from x (or y or independently for both) the more the color changes - like this?
I've searched SO for help with this, but only found solutions in which line segments were different colors. But, I want the color transition to be smooth (like this but not 3-D) instead of rough, and I want the color to depend on its distance from a particular value rather than pre-determined "randomly". A different SO post did something similar (not quite what I want though), but could only do so as a scatter plot, which only works for changing colors based on x-value if the peak is at x=0 - I'd prefer it be generalized. As an example, the further from x=0 the redder the curve gets. Ideally, there's a way to do this with a matplotlib colormap.