Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GR margin 0-point set to allow no padding #3942

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BioTurboNick
Copy link
Member

Currently, a 2mm pad is added to all plots, and the user-provided margin is added to it.

I propose that the 0-point for margins should be the box where all ink is visible and no larger. If a user wants no padding, 0mm is the natural choice to indicate that.

This change makes the user-provided margins override the default, rather than add to it.

Borderless plots can be generated with: plot([1, 2, 3], [5, 3, 6], widen = false, axis = false, ticks = false, margin=0(Plots.mm))

@BioTurboNick
Copy link
Member Author

For the tests, I suggest just changing the specified margin rather than changing the test images?

@BeastyBlacksmith
Copy link
Member

Would be good to make this consistent accross the backends

@BioTurboNick
Copy link
Member Author

BioTurboNick commented Nov 21, 2021

Checking to see where plot([1, 2, 3], [5, 3, 6], widen = false, axis = false, ticks = false, margin = 0(Plots.mm), legend = false) produces a borderless plot:

GR - fixed in this PR
PyPlot - ✅
Plotly - Horizontally borderless, vertically big borders; NOTE: also draws tick marks when it shouldn't. -- Got it to work, but it may negatively impact other aspects of display?
PlotlyJS - Same as Plotly
InspectDR - Huge borders on all sides; _update_min_padding! doesn't seem to affect anything? margin doesn't seem to work at all.
PGFPlotsX - Small borders; not sure where they are coming from, checked a few places. Strangely, decreasing margin size makes plot bigger but doesn't change the size of the minimal padding.
UnicodePlots - n/a
Gaston - Extermely slow; maybe hung? Had to terminate. NOTE: warnings for unsupported keyword arguments fillcolor and markerstrokecolor

@BeastyBlacksmith
Copy link
Member

I fixed the pgfplotsx case, @ma-laforge can you comment on InspectDR?

@t-bltg t-bltg added the GR label Nov 28, 2021
@ma-laforge
Copy link
Contributor

I just saw this question (I haven't had much time look at Github issues).

The intent of InspectDR wasn't originally to have fully controllable plots visuals, but rather have a Plots.jl compatible interface to a fast, interactive, GUI-enabled plotting tool. So I'm pretty sure I ignore many of the margin parameters.

That said, InspectDR probably does have the ability to control these margins - so it would be a good idea to support this feature.

I simply do not forsee having the time to fix this in the next few weeks. It would probably have to wait until January.

Sorry that wasn't the answer you were hoping to get - but thanks for pinging me to let me know.

@BioTurboNick
Copy link
Member Author

No worries, we can just move forward with the rest.

@BeastyBlacksmith
Copy link
Member

The more I think about this, the more I think we should keep that for 2.0, since I think there will be many people who currently have negative margins or the like who will get broken plots after this change.

@BioTurboNick
Copy link
Member Author

Yeah, I suppose that makes sense.

@iabraham
Copy link

I have spent a couple of days trying to deal with something I suspect is related (see second image here) but now that I chanced across this issue here; I think I should switch to a different backend (pyplot takes 3 minutes to make one of my plots though 😓).

Can someone confirm that the default GR behavior of not truly doing zero-padding or margins (especially visible as shown in gridded layouts) is what this PR is trying to fix?

@BioTurboNick
Copy link
Member Author

Yeah, there are hard-coded offsets. You can provide a negative offset to compensate, it's just annoying.

@iabraham
Copy link

Yeah, there are hard-coded offsets. You can provide a negative offset to compensate, it's just annoying.

Just to confirm ... is it the margin keywords that should be given the negative offsets to reduce spacing? Because that changes the spacing between subplots in a gridded layout but does nothing for the padding/space between an axis and its ticklabels unlike in the case of a single plot.

@isentropic isentropic mentioned this pull request Jan 12, 2024
37 tasks
@BeastyBlacksmith BeastyBlacksmith mentioned this pull request Mar 12, 2024
30 tasks
@BeastyBlacksmith BeastyBlacksmith mentioned this pull request Nov 16, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants