Scalable Vector Graphics (SVG) Export of Figures
Converts 2D & 3D Matlab plots to the scalable vector format (SVG). This format is specified by W3C (http://www.w3.org) and can be viewed and printed with internet browsers.
Added preliminary support of filter, clipping, and tickmark extensions that go beyond the Matlab functionality. SVG filters are a great tool to create stylish plots! Try it out! Before you start using this new features have a look at the tutorial. More information and examples can be found on my blog http://www.zhinst.com/blogs/schwizer/.
Tested browsers and editors for basic SVG support (no filters, no animation):
Opera 9.64,10.50,10.63 -> yes
Firefox 3.5,3.6,12.0 -> yes
Inkscape 0.46, 0.47 -> yes
Chrome 8.0,18.0 beta -> yes
Internet Explorer 9.0 beta -> yes
Internet Explorer 8.0 -> no
Internet Explorer + RENESIS -> yes
Tested browsers and editors for SVG filters:
Opera 9.64,10.50,10.63 -> yes
Firefox 3.5,3.6,12.0 -> yes
Inkscape 0.46, 0.47 -> yes (some limitations)
Chrome 8.0,18.0 beta -> yes
Internet Explorer 8.0, 9.0 beta -> no
Internet Explorer + RENESIS -> no
Editors for the SVG file format can be found at http://www.inkscape.org.
Usage:
> plot2svg % opens a file dialog to plot the active figure
or
> plot2svg('myfile.svg', figure handle, pixelfiletype)
pixelfiletype = 'png' (default), 'jpg'
See http://www.zhinst.com/blogs/schwizer/ to get more informations
Supported Features
- line, patch, contour, contourf, quiver, surf, ...
- markers
- image (saved as linked png pictures)
- grouping of elements
- alpha values for patches
- subplot
- colorbar
- legend
- zoom
- reverse axes
- controls are saved as png pictures
- log axis scaling
- axis scaling factors (10^x)
- labels that contain Latex commands are interpreted (with some limitations):
\alpha, \Alpha, \beta, \Beta, ... \infity, \pm, \approx
{\it.....} for italic text
{\bf.....} for bold text
^{...} for superscript
_{...} for subscript
How to use SVG files in HTML code
<object type="image/svg+xml" data="./mySVGfile.svg" width="140" height="100"></object>
Changes in Version 10-11-2010
- Support of the 'Layer' keyword to but the grid on top of
of the other axis content using 'top' (Many thanks to Justin
Ashmall)
- Tiny optimization of the grid display at axis borders
Changes in Version 25-08-2011
- Fix for degree character (thanks to Manes Recheis)
- Fix for problems with dash-arrays in Inkscape (thanks to
Rüdiger Stirnberg)
- Modified shape of triangles (thanks to Rüdiger Stirnberg)
Changes in Version 22-10-2011
- Removed versn as return value of function fileparts (thanks
to Andrew Scott)
- Fix for images (thanks to Roeland)
Changes in Version 20-05-2012
- Added some security checks for empty data
- Fixed rotation for multiline text
- Special handling of 1xn char arrays for tick labels
(thanks to David Plavcan)
- Fix for 'Index exceeds matrix dimensions' of axis labels
(thanks to Aslak Grinsted)
- Fix for another axis label problem (thanks to Ben Mitch)
Changes in Version 15-09-2012
- Fix for linestyle none of rectangles (thanks to Andrew)
- Enabled scatter plot functionality
Limitations:
- axis scaling factors for 3D axes
- 3D plot functionality limited (depth sorting, light)
Example of a SVG file is included to the zip file.
Reports of bugs highly welcome. |