Is it possible to have different colours in my plot in Scilab? I use the mtlb_hold to hold the graph and it works fine, but my problem is that then I have the same colours in my graph. In Matlab with the hold command, I have different colours. Is it possible to have different colours in Scilab too?
Thank you in advance.
Just found it. In the plot function, for example plot(), you can pass a second argument which specifies the color that will be used. For example, you can use use b for blue color, g for green, r for red and call plot() like this: plot(z,"r").
The SciLab documentation provides examples for using colors:
https://help.scilab.org/doc/5.3.3/en_US/color.html
The plot2d()-function e.g. accepts an attribute style, where you can even specify a color for each function with its full name:
plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
Related
I have trouble for plotting my raster and some points as sf object over that. I use aes(color=...) to assign color to different types of my points. But I want to change the colours to specific ones like red and blue and yellow. also I can't use scale_fill_manual because my raster layer's colours which is in first layer, shouldn't be changed. Is there any solution for this problem?
thanks in advance
geom_raster(data=dem2,aes(x=x,y=y,fill=elevation))+
geom_sf(data=mypoint,aes(shape=Type,colour=ranges))
The fill parameter inside aes wich you can manipulate manually using scale_fill_manual works perfectly with polygons or raster data. But, when you need to color points
or simple lines, the color parameter inside aes is prefered. Said that, if you want to assing different colors to your points, use scale_color_manual, this shouldnt interfer in your raster color.
package "ggnewscale" will work in this problem. It allows to use different scale for color in one plot.
Hey I want to create my own custom palette of color in R using the brewer.pal() function. And then I want to view it using the image function.
ny<-brewer.pal(7,"Blues")
image(x=1:7,y=1,z=as.matrix(1:7),col=ny)
This code gives 7 shdes of blue, however i want to give my own choice of 7 different colors.
image(x=1:7,y=1,z=as.matrix(1:7),col=c("Reds","Blues"))
I thought of trying this function, but its obvious wrong. Can someone please help me. I specifically want to use the brewer.pal() and image() funcions
If you'd prefer a gradient between 2+ colors of your choosing, you could also use colorRampPalette
pretty = colorRampPalette(c('#EF6780', '#80ef67', '#6780ef'))
image(x=1:7,y=1,z=as.matrix(1:7),col=pretty(200))
You can specify colors as hexadecimal colors in R. For example
image(x=1:7,y=1,z=as.matrix(1:7),col= "#CC6666")
References:
http://www.color-hex.com/
http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/
I've started to produce the charts for a paper. For some of them which are bar charts I've used the "Pastel1" palette (as recommended in the book on ggplot2, pastel colours are better than saturated ones for fill areas, such as bars).
The problem with Pastel1 at least is that when printed on a B&W laser printer, the colours are indistinguishable. I don't know if the readers will view the paper on screen or will print it on B&W, so I'm looking for either of the following:
how to add hash lines to a palette such as Pastel1 (hopefully the hash lines are also subtle)
a colour palette easy on the eyes that also produces distinct grey areas for B&W for, say, up to 3-4 different colours.
Granted, I could find the latter by experimenting and using toner, but perhaps this has already been solved, I suppose it's a common problem. And yes, I did google for this, but didn't find anything pertinent.
Thank you.
Use http://colorbrewer2.org/ and only show colour schemes that are printer friendly.
Also see scale_fill_grey.
Currently it's not possible to used hash lines due to a limitation in the underlying grid drawing package.
There is the col2grey function in the TeachingDemos package that will convert a set of colors to an approximation of the grey color that will result from printing. You can use this to try different pallettes without wasting toner/paper.
Use this to select another color combination (gray scale option included)
I am trying to illustrate a histogram of 33 different variables. Due to the number of variables I think "beside" different Colors I need to label each bar in a clear way, even using an arrow, if its doable.
I was wondering about
1) How can I define 33 distinct color in R
2) How can I label them, say vertical below X axis with a certain distance from each other to make my figure more clear.
I am using multhist function from Plotrix package, and for data you can image just 33 random vector with different length !
Thanks
As Chris mentioned, trying to distinguish 33 colours doesn't work for humans. You need to find a different plot type that doesn't rely on only colour.
Without a reproducible example, it is not possible to say what this plot should be, but here's some generic colour advice.
Use HCL colours rather the RGB or HSV. Read Escaping RGBland by Achim Zeileis for an explanation. There are some useful functions for generating palettes in the colorspace package.
If your variables are unordered categories (i.e., encoded as factors) then your colours should have different hues. (Use rainbow_hcl.)
If your variables are in some sort of order (ranges or ordered factors) then your colours should have different lightness or chroma. (Use sequential_hcl.) A variation on this is if they differ about some midpoint, in which case you need diverge_hcl.
You can define colors in R in any number of ways; try ?rainbow or ?greyscale for some suggestions
You could also look at all the colors here and just create a vector of your desired colors that you call inside your plot function.
Your problem though is that the human eye and the printing process has trouble distinguishing and reproducing that many distinct colors. See the documentation at the colorbrewer site for more information (and advice on picking colors).
Not sure I understand what your trying to do with the labels, but you can re-label an axis with a call to axis. See the documentation in ?axis.
The manual (pdf) doesn't seem to indicate any parameter responsible to change the labels' color. To be clear, I'm not referring to the numbers on the axis, but to the labels at the edges of the polygon.
I've used the first example taken from the solution given to this question.
I tried:
par(col.lab="grey")
before or after calling radarchart function, but it didn't work. The labels remained black.
The solution was to insert the following snippet just before calling the radarchart() function:
par(col="grey")
Doing so one changes the specification for the default plotting color.
See here for more.