plot icon indicating copy to clipboard operation
plot copied to clipboard

Why is `Plot.plotters` private ?

Open abourget opened this issue 7 years ago • 5 comments

I'm super happy to use the plotutil plot-making functions, but I'd also want to be able to tweak the plotters after the fact, simply changing colors or line size.. I see that the Plot.plotters list of Plotters is internal only.. could we expose that somehow ? with a Plotters() function or directly opening the Plotters field ?

abourget avatar Sep 03 '16 02:09 abourget

To have made a plot.Plot you must have had each of the plotters in your hand at some time. Can you not just modify them where you hold them (they are all pointer types). On the other hand, @eaburns, why is there an add rather than just appending to an exported slice?

kortschak avatar Sep 03 '16 05:09 kortschak

I just read the source for Add and it's pretty clear that exposing the retainer plotters would be a bad idea; the plot calculates the min and max of each plotter's x and y values - user changes to these would break behaviour.

@abourget, you can still do what I said in retaining your pointers and mutating the plotters that way, but I don't think we should be encouraging that.

kortschak avatar Sep 03 '16 05:09 kortschak

Dan, exactly. That's why.

eaburns avatar Sep 03 '16 13:09 eaburns

Couldn't the plotutil Add functions return the plotters?

Le sam. 3 sept. 2016 09:03, Ethan Burns [email protected] a écrit :

Dan, exactly. That's why.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gonum/plot/issues/312#issuecomment-244545151, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFs8FM8SjOg93UdAY66OipdcrdHcFQrks5qmW_9gaJpZM4J0NL7 .

abourget avatar Sep 03 '16 13:09 abourget

Maybe, but I forgot what those functions do, and I'm just on my phone right now.

eaburns avatar Sep 03 '16 14:09 eaburns