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

Background images for plots #219

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

Conversation

never-eat-yellow-snow
Copy link

See also: #216

This one also adds support for a preserve_aspect configuration for keeping the graph's aspect ratio (in case this makes sense for the graph). I didn't fiddle with the tests yet.

I also realized that this branch somehow contains the other two pull requests - this is probably because I'm new to git and done something wrong...

Anyway, please give me some feedback whether this feature has chances for the mainline or not.

@paradoxxxzero
Copy link
Member

I am in vacation right now I'll review as soon as I come back. Cheers. (For
multiple pull requests you have to create a separate branch for each)

Le dim. 7 juin 2015 11:15, never-eat-yellow-snow notifications@github.com
a écrit :

See also: #216 #216

This one also adds support for a preserve_aspect configuration for keeping
the graph's aspect ratio (in case this makes sense for the graph). I didn't
fiddle with the tests yet.

I also realized that this branch somehow contains the other two pull
requests - this is probably because I'm new to git and done something
wrong...

Anyway, please give me some feedback whether this feature has chances for

the mainline or not.

You can view, comment on, or merge this pull request online at:

#219
Commit Summary

  • Remove explicit open() calls on .css and .svg map files
  • fix testcases (run on linux, python3.4 with equivalent results to
    master branch)
  • - fix specifying a value_formatter, needed to be excluded from the
    json dictionary
  • Merge pull request lxml required before it is installed #1 from never-eat-yellow-snow/py2exe
  • Merge pull request render_to_png creates all black pictures #2 from never-eat-yellow-snow/pie-value-formatter
  • add possibility for background images

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#219.

@never-eat-yellow-snow
Copy link
Author

I did, but I probably made the mistake to merge them all back to the master branch of my fork... Anyway I'd clean up this mess when you say that this is something you consider for the main line.

Happy holiday!

@paradoxxxzero
Copy link
Member

So I looked into it, it may be useful to have a background image feature.
This PR needs some cleaning (there's print statements for instance).
Also, the preserve aspect ration seems to force a 1:1 ratio, wouldn't be better to adapt to the image ratio ?

@never-eat-yellow-snow
Copy link
Author

I'm aware of the need for the cleanup and I'll do it, if this is something you are willing to merge. I use this currently like this to create an overlay over a background image (assuming image.png has 600x400 pixels):

from pygal import XY

chart=XY(show_dots=False, 
         interpolate='hermite',
         include_x_axis=True,
         background_image="image.png",
         preserve_aspect=True,
         width = 600,
         height= 400,
         show_legend = False,
         )

chart.add('lowerleft', [(0,0)])
chart.add('upperright',[(600,400)])
chart.add('test', [(110,110), (500,300)])
out = chart.render()
open("test.svg", "wb").write(out)

You see that I have to manually add lowerleft and upperright hints to ensure the limits of the axis (maybe a seperate API would be good for that?).

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.

2 participants