Change the color of a character-pointtype in gnuplot - character

I am trying to set the color of a character-defined point type in gnuplot. Although I can select the desire color of a system defined point type, I cannot do the same with the character-defined one. Below I present a minimal example.
set samples 5
set term pdf
set o "mwe.pdf"
p x with points lt rgb "violet" pt "V",\
x with points lt rgb "violet" pt 2
set o
The result looks like this:
I also tried to set the color with the lc variable method and feeding the keyword using with a column ("#005893"), buit it still doesn't change the color.
Question
How can I set the color of the letter to achieve something like this:

the following works for me.
reset session
set samples 5
plot x with points pt "V" tc rgb "red" font ",20", \
x with points lt rgb "red" pt 2 ps 3
Result:

Character point types are rendered by the same driver routine that handles labels and other text. Therefore the color is taken from the current font and font properties apply, including color:
set sample 11
plot sin(x) with point pointtype "ยต" textcolor rgb "violet" font "/:Bold,15"

You should use textcolor instead of linecolor or linetype to change the point type defined by a character, as others pointed out already. See the gnuplot documentation.

Related

how can I show color of RGB triplet format in matlab?

I have a question in matlab
I need a simple code in matlab to get (R,G,B) and show the color of that.
For example get (1,0,0) and show red color. How can I do ?
Here is Example
To change the background color of a figure to green, specify the color with a short name, a long name, or an RGB triplet. These statements generate equivalent results:
whitebg('g')
whitebg('green')
whitebg([0 1 0]);
You can use ColorSpec anywhere you need to define a color. For example, this statement changes the figure background color to pink:
set(gcf,'Color',[1,0.4,0.6])
for more detail visit this http://in.mathworks.com/help/matlab/ref/colorspec.html?s_tid=gn_loc_drop

Matlab Default Color Orders and Types

I'm looking for a way, preferably a GUI, to change the default line colors, their orders, and the types globally.
I want to specify that the first line to be this color, this type, and this width; the second line to be that color, that type, and that width; and so on.
Maybe a uitable with the row names being the line number (the first, the second, etc.), the colors specified in the second column, the type in the third, and the width in the fourth. Something like this.
What is a good approach to solve this problem?
This is not fully the customization you are looking for, but you can set the default colors and line types (--, -., an so on) using DefaultAxesColorOrder and DefaultAxesLineStyleOrder, respectively:
myColorOrder = [
0 0.4470 0.7410 % rgb triplet
0.8500 0.3250 0.0980
0.9290 0.6940 0.1250
0.4940 0.1840 0.5560
0.4660 0.6740 0.1880
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840]
set(groot,'DefaultAxesColorOrder',myColorOrder,...
'DefaultAxesLineStyleOrder','-|--|:|-.')
Z = peaks;
x = 1:length(Z);
y = Z(4:7,:);
plot(x,y)
The rows in the 3-column matrix myColorOrder contain RGB triplets describing colors, and the row ordering of this matrix corresponds to line color order when setting DefaultAxesColorOrder property. The default line styles (set to DefaultAxesLineStyleOrder property) is a single string containing line styles separated by |.
Note that when setting several colors as well as line styles, plots will cycle as follows:
For first line style: cycle through all colors
Change to next line style: cycle through all colors
...
For details, see
http://se.mathworks.com/help/matlab/creating_plots/set-default-line-styles.html
If you really want to customize, you'll probably need to write a plot wrapper to customize plot line specs in the "manual way", however performed cleverly by the wrapper. See e.g. the code for Arrow3 by Tom Davis:
The current LineStyleOrder property will be used if LineStyle is
specified with '*'. MATLAB cycles through the line styles defined by
the LineStyleOrder property only after using all colors defined by the
ColorOrder property. If however, the global variable LineWidthOrder
is defined, and LineWidth is specified with '/', then each line will
be drawn with sequential color, linestyle, and linewidth.
Possibly you can make use of Tom Davis' approach and apply to Matlab line plots.

colored dots on matlab plot

I want to make a PCA-plot, where the colour of each dot is given by a special number. The colour of the dot should be from blue (small number) to red (large number). I am trying to do this:
scatter(pc(1,:),pc(2,:),15,c,'filled')
c - is a 1x40 array, where the numbers for each dot are written. I get only differently coloured dots, but not from blue to red.
Could someone help me please?
Your c argument is a vector if it is 1x40. According to the help for the SCATTER function:
When C is a vector the same length as X and Y, the values in C are linearly mapped to the colors in the current colormap.
This means that the colors you see are dependent on your colormap.
If you need each marker to be a specific color, you can take advantage of this behavior:
When C is a length(X)-by-3 matrix, it directly specifies the colors of the markers as RGB values.

Matlab How to receive color name after inputting RGB values

Matlab: How to receive color name after inputting RGB values
So I have this image and I used impixelregion to find the RGB values of each pixel. However, I want the name of the color to show up on Matlab. For example, if I input RGB values [9,9,11], I want Matlab to tell me that the color is black. Do I have to create my own function or code for this or is there something out there that can let me input whatever RGB values I want and have Matlab tell me what color those RGB values stand for?
thank you!
Here is a file with the name and corresponding color value, following wikipedia:
Colors_name_val.mat
And here is the corresponding code to give you the name of a color.
function name = name_rgb(my_val)
load('Colors_name_val.mat')
delta=10000000;
for k=1:430
curDelta=sum(abs(my_val-Val(k,:)));
if(curDelta<delta)
name=Name(k);
delta=curDelta;
end
end
end
It just find the less different color of the list, by minimising sum(abs(my_val-Val(k,:)))

I have a 2D plot in Matlab where I want to specify the RGB value for each point to vary to color

I am trying to plot a 2D line in Matlab with a color that varies based on an RGB code that I assign to each point. The code below works well for a given colormap ('col' values defining the color), but I am trying to keep tighter control over the color assignment, so that values always render the same color across multiple charts.
surface([x;x],[y;y],[z;z],[col;col],...
'facecol','no',...
'edgecol','interp',...
'linew',2);
The question is how do you decide which colour does each point have? defining the colormap is easy (shown below).
col=colormap(hot(128)) %% or other colour style like hsv or jet
if you have a variable (lets called it V) that for each point has a certain value and you want the colours to change based on that:
first define the values for the extremes in the colormap:
min_col=0; %%%can be the minimum of V
max_col=1; %%%can be the maximum of V
Then interpolate to your data
new_col=interp1(linspace(min_col,max_col,length(col)),col, V(:))