[Jprogramming] Specifying the size of a qt plot

Ric Sherlock tikkanz at gmail.com
Sat May 11 05:48:32 UTC 2019


I have been unsuccessfully trying to programmatically generate PNGs of
Plots of a desired size.

I can successfully save a plot as a PNG from a jQt session.

require 'plot'
pd 'reset'
pd */~ i: 10
pd 'show'
pd 'save png ',jpath '~temp/myplot.png'

However to get it the size I want I need to display the plot at the desired
size on the screen. The wiki (https://code.jsoftware.com/wiki/Plot/Commands)
suggests that using the `qt` command I should be able to set the display
size however this doesn't seem to work and the plot is always displayed at
the default size.
pd 'reset'
pd */~ i: 10
pd 'qt 800 600'  NB. no difference to just 'qt'

I am able to manually drag the displayed plot window to the desired size
and then run pd 'save png' but would like to be able to accomplish this
programmatically.

I note that the pd 'canvas 800 600' command and the pd 'pdf 800 600'
commands seem to work OK - but they don't provide me with a PNG!

Is there a bug in pd 'qt'?








pd 'canvas 800 600'

plot


More information about the Programming mailing list