Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to change colour of plots in Haskell GNUPlot.Simple package

I'm using GNUPlot.Simple for Haskell and am trying to change the colour of my plots.

Specifically when I use the code:

plotListsStyle [][ ((PlotStyle {plotType = Lines, lineSpec = CustomStyle [ PointSize 0.1, LineTitle "First "] }) , ( zip [0..10] [0..10]))]

I want to change the colour of the plot. I tried looking at the source code here https://www.stackage.org/haddock/nightly-2022-01-23/gnuplot-0.5.6.1/Graphics-Gnuplot-Simple.html, but couldn't figure out if there is anyway to do this.

Does anyone know how to do this or can recommend an alternative?

Thanks

like image 308
Key Avatar asked Dec 17 '25 23:12

Key


1 Answers

From a quick look at the summary page in your link, it seems that the Simple variant of the Haskell wrapper does not provide a means to access the "linecolor" attribute of lines, points, etc. So you get only the default colors.

On the other hand, if the script it produces is fed to a standard build of gnuplot then the program will on entry read a system- and/or user- initialization script. So you could change the default line colors in that initialization script and the change would affect subsequent execution of scripts produced by your Haskell wrapper.

For example, if you want the color of the first plot to be green and the second plot cyan, you could place the lines

set linetype 1 linecolor "forest-green"
set linetype 2 linecolor "cyan"

in the file ~/.gnuplot. That would replace the first two colors of the default sequence.

like image 127
Ethan Avatar answered Dec 20 '25 22:12

Ethan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!