how to find the number of colors for labeling in gnuplot? - gnuplot

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.

Related

Red color palette for gnuplot

I am looking for a palette in gnuplot for red color from very-light-red to deep-red. I found a script for black here http://gnuplot.sourceforge.net/demo_5.3/pm3dcolors.16.gnu
I tried by changing set palette functions red, red, red in the above script, but it is not working.
By "legend" do you really mean "palette"? The legend is the list of plot titles and samples; entries there will normally appear in whatever color the corresponding plot used. The palette is the color gradient used for pm3d plots. To define a gradient from white to deep red:
set palette defined (0 "white", 1 "dark-red")
test palette
If you want more precise control over how light/dark the two extremes are you can provide instead hexadecimal descriptions of the RGB components. E.g. the above command is equivalent to
set palette defined (0 "0xffffff", 1 "0x8b0000")

How to define color range of particular color from RGB/CMYK/Hexcode model?

I am trying to find a segment in color wheel which is dedicated to particular color only (For example, red or green or black or violet).
So far, i have tried following:
I used 12 colors and 20 shades of each color to narrow down a color range(https://digitalsynopsis.com/design/color-thesaurus-correct-names-of-shades/). But, i was clearly not able to define the range of particular color because i have not found any pattern which could say when i will enter into differen color segment.
For example, to define black color, what digit should be the minimum and maximum in RGB or any other module?

Default weighing criterion for gnuplot's 'lc palette'

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

Specify RGB colour of contours with matplotlib

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)])

How to pick good contrast RGB colors programmatically?

Suppose, in your program:
color A is a color we randomly select
Knowing color A, how can I pick a color B that will be in high contrast with color A?
The problem can be further reduced to: "imagine 2 squares filled with color next to one another. It should be unambiguously clear to a human eye that colors are not the same"
Example:
Black --> White
Blue --> White
There is some information in the Web Content Accessibility Guidelines (WCAG) 2.0 (http://www.w3.org/TR/2008/REC-WCAG20-20081211)
Visual contrast: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast
Contrast ratio: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
Relative luminance : http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
There's a good example in this site but he calculate where two colors are enough, not how to get them.
To choose a color with good contrast, I'd go with complementary colors: for example, choose the random color A, transform it to a HSV space, get the complementary hue.
Complementary hue: after you transform color from RGB to HSV, complementary hue will be 180 degrees appart (or 0.5, in a 0-1 normalized hue value). This site has something about it in PHP
As I was searching for a better way to do this, i stumbled across the Adobe Illustrator guide which mentions how they create complementary colors. They say:
Complement Changes each component of a color to a new value based on the sum of the highest and lowest RGB values in the selected color. Illustrator adds the lowest and highest RGB values of the current color, and then subtracts the value of each component from that number to create new RGB values. For example, suppose you select a color with an RGB value of 102 for red, 153 for green, and 51 for blue. Illustrator adds the high (153) and low (51) values, to end up with a new value (204). Each of the RGB values in the existing color is subtracted from the new value to create new complementary RGB values: 204 – 102 (the current red value) = 102 for the new red value, 204 – 153 (the current green value) = 51 for the new green value, and 204 – 51 (the current blue value) = 153 for the new blue value.
It wouldn't be too hard to do this programmatically and think this time that it might actually work for what you are trying to do.
Good Luck!

Resources