wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
476 stars 98 forks source link

Graph File Formats Not Supported #600

Closed rlbowman closed 9 years ago

rlbowman commented 9 years ago

I have been using wxMaxima for a few months now under Windows 10, and when I right-click a graph to save it, I can select from four different formats. However, they all save as png files with only a different extension. That is, jpg, bmp and xpm are all just png files with a different extension. Can this be fixed? Thanks.

gunterkoenigsmann commented 9 years ago

Just for the sake of completeness: If there is a possibility to use .png instead of .jpg for diagrams normally .png gives a better compression and much sharper images sithout jpeg's ringing at each sharp edge. For photographs .jpg tends to wins by a factor of 10...100, in respect to compression, though.

rlbowman commented 9 years ago

Thanks for fixing this. I am fine with any file format as long as they can give a high enough quality. My only problem with wxMaxima was that it said it was saving a graph in different formats but did not do so. In the past I have had difficulties with png files and its background if it was set to transparent. But either the format has matured or my usual program, IrfanView, is handling png better because I have not had any problem with the output from wxMaxima.

gunterkoenigsmann commented 9 years ago

Then I understand the problem. It is surprising in how many places transparency produces unexpected results.

If you need to export images frequently there is a possibility to make the worksheet do so:

 mydraw(name,[contents]):=
 (
     wxdraw(contents),
     draw
     (
         append(
             [
                 terminal=pngcairo,
                 file_name=name
             ],
             contents
         )
     )
 );

After these lines a

 mydraw("filename",explicit(sin(x),x,1,10)$

produces both a embedded plot and a file.

Kind regards,

Gunter.
rlbowman commented 9 years ago

Thanks, for the additional info, Gunter.

As a retired US physics professor who is now teaching physics and chemistry to Albanian students in an American-style high school in Lezhë, I moved to Maxima about two years ago since Mathematica is so expensive for a private individual.

This past summer I returned to one of my early research interest--Iterated Function System fractals. So, yes, I need to do a lot of plotting and saving of the plots. Almost all that I am doing are discrete 2D plots. I think I have figured out looping in Maxima (from... do...), but I still am working with wxplot2d to try to figure out how to force it to give me the de facto scaling I want. Usually I want the same size of scale on both the x- and y-axis. Using [x, xmin, xmax], etc. does not seem to work with discrete plots in Maxima. So I have forced it by plotting a few points outside of my fractal to get the correct scaling of the fractal.

Again, thanks for your help.

Richard

On Mon, Oct 26, 2015 at 6:27 PM, Gunter Königsman notifications@github.com wrote:

Then I understand the problem. It is surprising in how many places transparency produces unexpected results.

If you need to export images frequently there is a possibility to make the worksheet do so:

mydraw(name,[contents]):= ( wxdraw(contents), draw ( append( [ terminal=pngcairo, file_name=name ], contents ) ) );

After these lines a

mydraw("filename",explicit(sin(x),x,1,10)$

produces both a embedded plot and a file.

Kind regards,

Gunter.

— Reply to this email directly or view it on GitHub https://github.com/andrejv/wxmaxima/issues/600#issuecomment-151216885.

gunterkoenigsmann commented 9 years ago

I only once had a good physics teacher but this one was really excellent. And fractals - I once knew a guy that knew fractint by heart including all the algorithms behind it...

For your question: Maxima doesn't provide the users with a way to set the aspect ratio of a plot - and I am convinced that gnuplot lets one directly choose the aspect ratio of the resulting image including the margins - but it still might determine that the margins might be of different sizes.

There is a way of telling it to keep the margins equally-sized, though:

  wxdraw2d(
      user_preamble="set size ratio 1;set tmargin 3;set bmargin 3;set lmargin 3;set rmargin 3",
      explicit(sin(x),x,1,10)
  ),wxplot_size=[1000,1000];

If you want most images in this format there should be a set_draw_defaults command that does what you want it to.

In order to make the numbers maxima produces more similar to what a physics student might expect I always do a

      load("engineering-format")$

This file has been written by Robert Dodier and is quite helpful. If you don't need it you can add a

      ,engineering_format_floats=false

to the end of a calculation.

The current nightly build has drastically improved the way images are handled. And if you use Wolfgang's ccl-based installer from maxima.sourceforge.net it has a fairly complete support for greek letters in case that you need them. If you didn't already do this you should give it a try. Instructions on where to get it can be found at http://andrejv.github.io/wxmaxima/develop.html

Kind regards,

Gunter.
gunterkoenigsmann commented 9 years ago

Another thing that is only relatively little known but might be helpful for teaching physics is animations using with_slider_draw:

 with_slider_draw(
     t,makelist(i/10,i,1,100),line_type=dots,color=red,
     explicit(sin(x+t),x,1,10),color=green,
     explicit(sin(x-t),x,1,10),line_type=solid,color=blue,
     explicit(sin(x+t)+sin(x-t),x,1,10),
     grid=true,
     title=concat("t=",float(t),"s"),
     yrange=[-2,2]
 ),fpprintprec=2;

Kind regards,

Gunter.

rlbowman commented 9 years ago

Gunter, thanks so much for your assistance. I will have to try all of these out.

Richard

On Mon, Oct 26, 2015 at 9:48 PM, Gunter Königsman notifications@github.com wrote:

Another thing that is only relatively little known but might be helpful for teaching physics is animations using with_slider_draw:

with_slider_draw( t,makelist(i/10,i,1,100),line_type=dots,color=red, explicit(sin(x+t),x,1,10),color=green, explicit(sin(x-t),x,1,10),line_type=solid,color=blue, explicit(sin(x+t)+sin(x-t),x,1,10), grid=true, title=concat("t=",float(t),"s"), yrange=[-2,2] ),fpprintprec=2;

Kind regards,

Gunter.

— Reply to this email directly or view it on GitHub https://github.com/andrejv/wxmaxima/issues/600#issuecomment-151280396.