FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

some problem in eps file · Issue #8901 · matplotlib/matplotlib · GitHub

Repository navigation

some problem in eps file #8901

Closed
Closed

Description

I think that is a matplotlib characteristic, when one draw a plot

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 500)
dashes = [10, 5, 100, 5]  # 10 points on, 5 off, 100 on, 5 off
fig, ax = plt.subplots()
line1, = ax.plot(x, np.sin(x), '--', linewidth=2,
                 label='Dashes set retroactively')
line1.set_dashes(dashes)
line2, = ax.plot(x, -1 * np.sin(x), dashes=[30, 5, 10, 5],
                 label='Dashes set proactively')
plt.xlim(1, 9)
ax.legend(loc='lower right')
plt.savefig('test1.eps', dpi=1000)

set the xlim will force the X-axis within 1-9, the line segment outside 1-9 hide, but it just hide not be clipped, I don't know how can i actually clip elements with axes extent.

I use Adobe Illustrator to open eps file.
You see it is fine,

But actually it is,

In sometimes, this characteristic is very useful, for example, if one use plt.show() to use the interactive mode, one can drag the canvas to left or to right to see the whole line in the range 0-10.

But in eps file, i do not think this characteristic reasonably, it typically increases the eps file size.
Is it a method to change this behavior ?

Matplotlib: 1.5.X or 2.0.X
OS: Windows 10 or CentOS

Activity

  1. added this to the milestone on Jul 17, 2017
  2. tacaswell commented on Jul 17, 2017

    Member

    That isn't quite how how the panning works; each time the plot updates it is fully re-drawn.

    Looking at the code (in matplotlib.backends.backend_eps.RendererPS.draw_path at  https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_ps.py#L493 and https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_ps.py#L470 ) it looks like it should be clipped before outputting to the eps file.

  3. WeatherGod commented on Jul 17, 2017

    Member
  4. tacaswell commented on Jul 20, 2017

    Member

    The dash pattern is set on the graphic context and I am pretty sure I reproduced this with solid lines...

  5. github-actions commented on Apr 15, 2023

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  6. QuLogic commented on Apr 19, 2023

    Member

    If I run this and open in evince, the lines are correctly clipped, but if I open it in Scribus, then they are not. This might be just a viewer problem, but perhaps there is some less-defined behaviour we are using that could be improved.

  7. QuLogic commented on Apr 20, 2023

    Member

    After a bit of review of what Scribus appears to do, and what is in the original report, we've come to the conclusion that this is expected behaviour. The line appears to be selected in the original post, so while it appears bigger, it is clipped to the Axes box, but just its data continues outside of it. However, testing confirms that the line data is cropped to the Figure bounds. While we could increase that cropping to the Axes itself, that won't necessarily save output size that much given the existing cropping. I think there's an existing issue already for better clipping (#9488 and similar), so we'll close this one.

  8. removed this from the future releases milestone on Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL