Note: This discussion is about an older version of the COMSOL Multiphysics^{®} software. The information provided may be out of date.

**Discussion Closed** This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

## Preparation of figures for papers/thesis?

Posted 2013年2月11日 GMT-0500上午12:19 Parameters, Variables, & Functions, Results & Visualization Version 4.3a 12 Replies

I am using COMSOL 4.2a, and want to use some surface plots alongside legends of the colour tables used. It is bizarre that COMSOL does not provide vector graphics export. I have tried to generate a decent image using the png export (via the 'snapshot' button -- is there any other way?), but it is horrible.

How I am doing it is:

1. Use highest 'Quality' settings in each component of the plot group that has such a setting (e.g. Surface; Contour)

2. Set export resolution to 1200 DPI

3. Set image dimensions to highest possible (for me it seems 4096 pixels is the upper limit?).

4. First generate a snapshot without any includes (i.e. no title, legend, axes. etc)

5. Then generate a snapshot with the legend included.

6. In GIMP cut and paste and scale as required.

See attached file for example of trying to export a surface plot with two colour legends. The model image part of the figure is tiny, and the legends huge.

If anyone has any tips or a separate set of routines in python/matplotlib or similar already in place I would love to see it!

Attachments:

Good luck with that, I have the same darn problem. In versions 3.5 and lower COMSOL allowed to export 2D graphics as eps format, then under 4.x they got rid of that, expect for 1D line plots, dumb move on their part. I guess you can plot the figure in Matlab and save as eps there, but that is a pain, not to mention you might want to export geometry as a vector graphics. Who would want png etc files anyway?, having the ability to open your vector graphics in, say, Illustrator is critical for generating publication quality figures, in my opinion at least. I sent this suggestion to the COMSOL help a long time ago.

~C

I sent this suggestion to the COMSOL help a long time ago.

I guess they don't see it as a priority :(

I'm trying to work out how to do it with gnuplot at the moment. If that fails then maybe python/matplotlib.

If I get anywhere useful I'll post back code.

Ben.

2. Set export resolution to 1200 DPI

3. Set image dimensions to highest possible (for me it seems 4096 pixels is the upper limit?).

that's ridiculous. Such settings would be good for a billboard, not for a little plot in paper/thesis. Typically I use default settings which produce good quality even when printed on full letter-size page.

Thank you for your comments and suggestions. In this case I would recommend trying a lower DPI, as this would produce a bigger image (a DPI setting of 1200 and a width of 4096 pixels results in an image just over 3 inches in width). The DPI setting also affects the size of the included extras, a lower DPI setting yields smaller colorbars/legends/etc.

An alternative method that can be useful is to resize the GUI image frame to the desired size before exporting it. In the Image snapshot menu, change the Image size to Current - the image will now be exported using the current size of the Graphics window.

Best regards,

Anders Ekerot

COMSOL

Thank you for your comments and suggestions. In this case I would recommend trying a lower DPI, as this would produce a bigger image (a DPI setting of 1200 and a width of 4096 pixels results in an image just over 3 inches in width). The DPI setting also affects the size of the included extras, a lower DPI setting yields smaller colorbars/legends/etc.

Thanks Anders, that helps.

An alternative method that can be useful is to resize the GUI image frame to the desired size before exporting it. In the Image snapshot menu, change the Image size to Current - the image will now be exported using the current size of the Graphics window.

This suggestion leaves little flexibility, but thanks again.

I particularly want to control line thicknesses and colours, shape colour schemes and border thicknesses, perhaps highlight particular isotherms, etc.

Is there really no prospect of vector graphics export?

Or a means to export the data set into vtk (for example) to be able to visualise with a specialist software like Paraview?

Ben.

I particularly want to control line thicknesses and colours, shape colour schemes and border thicknesses, perhaps highlight particular isotherms, etc.

Is there really no prospect of vector graphics export?

Or a means to export the data set into vtk (for example) to be able to visualise with a specialist software like Paraview?

Thank you for the update.This was also mentioned previously in the thread by Chris L; a possible way forward is to use COMSOL's LiveLink for MATLAB interface. This setup requires both MATLAB and COMSOL's LiveLink for MATLAB product (www.comsol.eu/products/livelink-matlab/). When working with the LiveLink for MATLAB interface, COMSOL plots are created in standard MATLAB figure windows. This gives us access to MATLAB's plot edit mode to control line thicknesses/colors/etc; MATLAB also supports the saving of 2D plots in EPS format. If you have access to both MATLAB and the LiveLink for MATLAB, this is the option we recommend.

Best regards,

Anders Ekerot

I particularly want to control line thicknesses and colours, shape colour schemes and border thicknesses, perhaps highlight particular isotherms, etc.

Is there really no prospect of vector graphics export?

Or a means to export the data set into vtk (for example) to be able to visualise with a specialist software like Paraview?

Thank you for the update.This was also mentioned previously in the thread by Chris L; a possible way forward is to use COMSOL's LiveLink for MATLAB interface. This setup requires both MATLAB and COMSOL's LiveLink for MATLAB product (www.comsol.eu/products/livelink-matlab/). When working with the LiveLink for MATLAB interface, COMSOL plots are created in standard MATLAB figure windows. This gives us access to MATLAB's plot edit mode to control line thicknesses/colors/etc; MATLAB also supports the saving of 2D plots in EPS format. If you have access to both MATLAB and the LiveLink for MATLAB, this is the option we recommend.

Best regards,

Anders Ekerot

So now, basically, options that were once included in the COMSOL base software now require the purchase of additional add ons. Smart move.

Let's not fail to mention that many things that once required add-ons are now feasible with just the base software. To name but a few: geometry parametrization, mesh parametrization, multi-step solution processes, too many post-processing plot types to list here, comparing solutions obtained with different meshes or different values of a parameter, a host of geometry operations, generating custom reports, importing a mesh, exporting a mesh, using virtual geometry operations, etc...

Jeff

Hi Chris,

Let's not fail to mention that many things that once required add-ons are now feasible with just the base software. To name but a few: geometry parametrization, mesh parametrization, multi-step solution processes, too many post-processing plot types to list here, comparing solutions obtained with different meshes or different values of a parameter, a host of geometry operations, generating custom reports, importing a mesh, exporting a mesh, using virtual geometry operations, etc...

Jeff

Yes, fair enough. But considering what COMSOL is and how often it is used in research, having the ability to produce standard graphics seems pretty core. Not to mention, the solution suggested by COMSOL themselves requires (expensive) 3rd party software in addition to their own add on. Just to have an eps graphic, when they used to have it standard, it is really frustrating.

~Chris

probably the X houndred or tousand of us with COMSOL manage to live without eps, or use other softeware formats.

Personally I have a longer list on the physics side I hope COMSOL will implement in the future, rahter than a full set of detailed plotting options for 1 particular format. Even if I fully nerstand your frustration, as correctly made plots, with titles and nits are mandatory, not only for "publishing" but also for enginnering reports. Luckily for me, most enginnering contracts are more focusing on the "correct" results, than on the nicest show, so I can get accepted handwritten or added titles, units and other comments, on my graphs, for my publications

--

Good luck

Ivar

Thank you for the update.This was also mentioned previously in the thread by Chris L; a possible way forward is to use COMSOL's LiveLink for MATLAB interface. This setup requires both MATLAB and COMSOL's LiveLink for MATLAB product (www.comsol.eu/products/livelink-matlab/). When working with the LiveLink for MATLAB interface, COMSOL plots are created in standard MATLAB figure windows. This gives us access to MATLAB's plot edit mode to control line thicknesses/colors/etc; MATLAB also supports the saving of 2D plots in EPS format. If you have access to both MATLAB and the LiveLink for MATLAB, this is the option we recommend.

Best regards,

Anders Ekerot

Hi guys,

I exported my plots to Matlab, but I'm not able to save the plat as a vector image. The .eps always ends up in a pixel figure. Has someone a clue what I making wrong????

Thx

Note that while COMSOL employees may participate in the discussion forum, COMSOL^{®} software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.