Open neilpanchal opened 9 years ago
Interesting. Does the same thing happen if you use SVG
instead of SVGJS
?
With SVGJS grid lines and ticks are generated at multiple scales and hidden unless you zoom in or out. I suspect that the PDF conversion ignores the hidden attribute.
@dcjones
ohhh...that makes sense. I tried it with SVG instead of SVGJS option and it worked fine!
I found another bug where using iPython notebook. When I roll over the plotting area, the grid lines appear to glitch and it is different every time I hover the cursor over it. See some examples:
After a few times, it stop glitching and the grid lines are constant. Is it because when I hover over, the grid lines animate/fade? Not sure but just wanted to report this as it appears to be related to JS implementation.
What version of Gadfly are you using? I think I fixed this, but I probably haven't tagged a new version since doing so.
@dcjones Gadfly: 0.3.12
Oh yeah, I did fix this in https://github.com/dcjones/Gadfly.jl/commit/08716bfc6fb0570840397dc0361686905e102cfc. I should tag a new version soon.
@dcjones Thanks Daniel. Is there any fix for SVGJS for printing in iPython? It would be nice to have dynamic plots displayed in the HTML notebook but it should switch to SVG method when printing statically.
I'll look into it, but I suspect the fix will have to be in ipython/jupyter. It should really just respect the SVG visibility
attribute.
@dcjones Do you think I should file this issue @ https://github.com/JuliaLang/IJulia.jl
When I print to PDF, it actually looks ok:
On the other hand, when I use the "download as PDF" feature the result is broken in a entirely different way:
How were you exporting the pdf?
@dcjones The just used File > Download as > PDF via Latex (.pdf) option in iPython notebook.
Ok, ipython uses Inkscape to convert SVG to PDF. So I think to boils down to an inkscape issue. If you have it installed, can you test if SVG from Gadfly looks right inkscape?
I ran into this issue to. I wonder where the best place to document it so others have an easier time figuring it out.
To get File > Download as > PDF via Latex (.pdf) option in iPython notebook working with a Gadly plot I did the following:
brew cask install inkscape
draw(SVG(20cm, 10cm), myPlot)
I am using iPython/Jupyter notebook with Julia version 0.3.9. I am trying to a histogram that is generated using the following code:
The output in iPython notebook looks like this:
When I print the notebook using nbconvert to PDF (using the default latex template), I get an output like this.
The only problem is that the iPython notebook plot is tiny using default settings. I want to specify the size of the output in pixels or cm. So, I googled for a solution and came cross this thread:
http://julia-programming-language.2336112.n4.nabble.com/change-size-of-individual-plot-in-gadfly-under-IJulia-td14000.html
Quoting @dcjones
Ok, so I simply changed by code to output as follows:
Output (as follows) looks great in iPython!
However, when I print again using nbconvert to PDF, I get this ugly mess. From the looks of it, the tick marks are pretty much arbitrarily spaced.
Any suggestions on what is going on when I convert the notebook? I am not too familiar with the background processes that generate SVG.