|
From: Ethan M. <eam...@gm...> - 2023-05-17 20:40:10
|
On Wednesday, 17 May 2023 09:47:43 PDT Debostuti Ghoshdastidar wrote:
> Hi Ethan
>
> Thank you for the solution. Each Y column will be a score for a particular
> amino acid. The Y columns will be in increasing order of the score value.
> Each Z will always correspond to a particular color we use to represent the
> amino acid that will be in the corresponding y column. We will use a set of
> 20 colors to represent 20 amino Acids.
Ah. In that case you probably don't want "lc palette", which assumes
a continuous range of values and a smoothly-varying color palette.
Instead define 20 distinct colors in a convenient range of linetypes,
say lt 101 through lt 120, indexed by the value in column Zn.
That matches this demo from the on-line collection very closely:
https://gnuplot.sourceforge.net/demo_5.4/histogram_colors.html
If you have the one letter code in the Z column (P for Proline, etc)
you could use pieces of the demo code directly.
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
color(category) = 100 + strstrt(alphabet, category)
plot for [i=2:*:2] DATA using (column(i)):(color(strcol(i+1)) lc variable
Otherwise you could define a slightly more complicated color() function that
for instance maps from the 3-letter code, e.g.
array AA = ["Ala", "Cys", "Asp", "Glu", ...]
color(category) = 100 + sum [1:20] (category eq AA[i]) ? i : 0)
cheers,
Ethan
>
> Debostuti
>
> On Wed, 17 May 2023, 21:36 Ethan Merritt, <eam...@gm...> wrote:
>
> > On Tue, May 16, 2023 at 9:52 PM Debostuti Ghoshdastidar <
> > deb...@gm...> wrote:
> >
> >> Dear Users
> >>
> >> I have data in the following format
> >>
> >> X1 Y1 Z1 Y2 Z2...Yn Zn
> >> X2 Y1 Z1 Y2 Z2...Yn Zn
> >> .
> >> .
> >> .
> >> Xn Y1 Z1 Y2 Z2...Yn Zn
> >>
> >> I would like to draw a rowstacked histogram (which I know how to) where
> >> the
> >> colors for the bars are specified by the corresponding Z columns. For
> >> example Y1 should be colored based on Z1 value, Y2 based on Z2 value, and
> >> so on...mush like the use of cbrange. Could you suggest how I can
> >> accomplish this?
> >>
> >
> > set style data histogram
> > set style histogram rows
> > set style fill solid border lc "black"
> > set cbrange [0:<something>]
> > plot for [i=2:*:2] DATA using (column(i)):(column(i+1)) lc palette title
> > "???"
> >
> > It is not clear to me how you would label or construct a legend describing
> > this in a way that is easy for the viewer to understand. Perhaps
> > superimpose
> > a label on top of each individual box?
> >
> > Ethan
> >
> >
> >
> >
> >
> >> Thank you
> >>
> >> Debostuti
> >> --
> >> Debostuti Ghosh Dastidar
> >> Research Associate
> >> PDB-India
> >>
> >> _______________________________________________
> >> gnuplot-info mailing list
> >> gnu...@li...
> >> Membership management via:
> >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
> >>
> >
>
|