sciapp / gr

GR framework: a graphics library for visualisation applications
Other
328 stars 54 forks source link

Only one subplot drawn when using gr.beginprint() (Python) #87

Closed Modiug closed 5 years ago

Modiug commented 5 years ago

Version is 1.10.0 (Python)

The following script will open a "GKS QtTerm" correctly showing two subplots. However the gr_test.png created with gr.beginprint() only shows the lower subplot.

import gr
from gr.pygr import mlab

gr.beginprint('gr_test.png')

mlab.figure()
mlab.subplot(2,1,1)
mlab.plot(range(100), lambda x: x**2)
mlab.subplot(2,1,2)
mlab.plot(range(100), lambda x: x**3)

gr.endprint()

Regards Guido

FlorianRhiem commented 5 years ago

Hello Guido, thanks for reporting this. It seems to be a bug in the cairoplugin caused by setting the workstation viewport repeatedly. As a quick workaround, you can export a pdf instead of a png, which should work correctly.

FlorianRhiem commented 5 years ago

This should be fixed by commit 01560eacde287732f6b29a03b5fa90cc17953985.

Modiug commented 5 years ago

Hi Florian, thanks, but I was actually using the gr.beginprint() mechanism to write to memory for integration with tkinter/PySimpleGUI. Will wait for the next release then (not urgent).

FlorianRhiem commented 5 years ago

Ah, the memory output also uses the cairoplugin, so the fix should work as well.

FlorianRhiem commented 5 years ago

The fix was released as part of gr 0.41.0 / python-gr 1.11.0.