Skip to content

Conversation

@sbinet
Copy link
Member

@sbinet sbinet commented Feb 2, 2016

This CL exports a few internals of plot:

  • plot.HorizontalAxis
  • plot.VerticalAxis
  • plot.Axis
  • plot.Legend.Draw

such that user-defined plot styles can be created.

an example of such a user-defined plot style has been added as plotter.ExampleHistogramGnuplot.

@sbinet
Copy link
Member Author

sbinet commented Feb 2, 2016

one of my users (@ebusato) asked whether it was possible to have a more "high energy physics"-y style for his plots.
I revived my old branch.
PTAL.

@kortschak
Copy link
Member

I'm OK with this.

@sbinet
Copy link
Member Author

sbinet commented Feb 4, 2016

@eaburns what do you think?

@sbinet sbinet force-pushed the flexible-styles-updated branch from 32dad3a to f8a5887 Compare February 4, 2016 09:11
c.Fill(c.Rectangle.Path())
}

{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra nesting here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to limit the scope of xpad and ypad. (so they aren't unadvertantly modified afterwards)
I can remove.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (extra nesting removed)

@eaburns
Copy link
Member

eaburns commented Feb 4, 2016

Sorry I'm slow. My wife and I just had a baby, so it's been a very busy and sleepless week.

I don't like GNU plot's style. That is one of the reasons I wrote my own plotting package to begin with. (Actually, Plotinum was my second plotting package, see https://code.google.com/archive/p/caml-spt/) That said, I don't have a problem with this type of change. While I can complain about an ugly style, I don't have the artistic ability actually create a beautiful one myself. That is why Plotters exist, so people with better taste than myself can make their own styles. This seems inline with that idea.

Two things:

  1. I don't like that Plot.Axis.Padding is silently ignored by the GNU plot style. We should find a different way to communicate style parameters. I think that they should be part of the style structs themselves, not the Plot or Axis.
  2. More of a note or complaint: this doesn't entirely mimic GNU plot. GNU plot has the terrible behavior of drawing the tick marks INTO the plot, obscuring the data. If someone truly wants to mimic GNU plot, they would need the ability to do that too. I'm OK leaving it out.

@sbinet
Copy link
Member Author

sbinet commented Feb 4, 2016

no worries (and congratulations!)

wrt having the ticks inside/outside the data-canvas: we actually might need to support it, if/when we support multiple Y-axes (ie: if you put Y-axis-1 on the left and Y-axis-2 on the right)

I am not hellbent on having a gnuplot-style, it's just the (general looking) style my community is used to.

@sbinet
Copy link
Member Author

sbinet commented Feb 19, 2016

ping?

@eaburns
Copy link
Member

eaburns commented Feb 19, 2016

Did we ever come up with a solution for my point 1, above?

@sbinet sbinet force-pushed the flexible-styles-updated branch from f8a5887 to db6dd03 Compare April 4, 2016 15:12
@sbinet
Copy link
Member Author

sbinet commented Apr 4, 2016

rebased against master (f1e699e)

wrt your point 1 (silently ignoring plot parameters), pragmatically, it is inevitable, I believe, that some plotting style ignore some plot parameters (a style that doesn't display axes at all won't need axes' styles).
I have also laid out a few possible alternatives I dabbled with in comment #245 (comment)

what do you think about them ?

@sbinet sbinet force-pushed the flexible-styles-updated branch from db6dd03 to 0bfb59e Compare April 9, 2016 13:34
@sbinet sbinet force-pushed the flexible-styles-updated branch from 0bfb59e to b9d5b59 Compare April 20, 2016 07:58
@sbinet sbinet force-pushed the flexible-styles-updated branch from b9d5b59 to e1e8094 Compare July 6, 2016 16:08
@sbinet sbinet changed the title flexible styles (e.g. gnuplot-like style) flexible styles (e.g. a custom plot style) Jul 6, 2016
@sbinet
Copy link
Member Author

sbinet commented Jul 6, 2016

Today, I tried a bit harder to have a general theme.Theme structure (which I called style.Plot, together with a plot.Style interface)
The beginning of such a work is over there:

master...sbinet:theme-plot

I had to actually couple each of the "data" structs with the "style" structs (see plot.Axis.Style and plot/style.Axis for example, or plot.Plot.Style).
At least I didn't manage to come up with a nice decoupled way to apply styles (or themes) to plots, axes, legends and ticks...

so... while there was a nice side-effect of grouping the style related informations into "style" structs (potentially: no more error needed in the defaultstyle for plot.New), I think that #245 is a good enough compromise so people can re-use a good chunk of types and funcs from gonum/plot while still being able to customize the gonum/plot.Plot final look.

@kortschak @eaburns PTAL.

Can we please decide whether this is deemed useful or not? (if not then I can concentrate on providing that feature inside "my" plot package)

@sbinet
Copy link
Member Author

sbinet commented Aug 9, 2016

ok. I'll integrate this into "my" plot package.
thanks for your time.

@sbinet sbinet closed this Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants