License

Copyright (c) 2005, Juerg Schwizer
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

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/.

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)

@Martin - the version of plot2svg on the Matlab File Exchange is relatively old (2012) compared to the latest one on Github (<a href="https://github.com/jschwizer99/plot2svg -2015), so I suggest that you download from Github.

Probably very useful when it was created, but now Matlab can save directly as an svg, and Matlabs standard has changed so much that this function needs alto of modification to run. I found getting it to run with scatter plots was fairly easy, but hadn't managed to get it to read axis labels or legends before deciding to use the inbuilt svg save in Matlab.

For those having the "Requires character vector array input" error in R2017a /b, if you go in and change the lines that say "str2num(get(ax,'YTickLabel'));" and "str2num(get(ax,'XTickLabel'));" to read "str2num(char(get(ax,'YTickLabel')));" it should fix it. (Somewhere around line 2454).

Many thanks for your work on this - very useful.
An (esoteric) side note to any CorelDRAW users: if you use Matlab to make curves for import to CDR (as PDF), you may have noticed there is some kind of limit to the number of nodes before CDR makes separate curve segments... this can make problems. Importing SVG, e.g. made with this m-file here, doesn't seem to suffer from this problem.

Great for plotting any graph with transparent color components! I absolutely love how my plots look.

Only thing I am having trouble is that it will actually not write the axes labels. I tried a few things, but it just won't do in the new 2016b version. I tried running the sample codes. It wouldn't take the legend handle and also the title and the axes labels are missing.

On my end, error bars overlaid on a mesh are not being reproduced properly on my end. The error bars are either on top the surface or completely hidden below (they should be half n' half, i.e. sticking out). Everything else working fine so I'm assuming that's a bug/limitation? Thanks!

Unfortunately the exported example svg file of demo_3d_plot2svg.m has an error, it cannot be opened in Adobe Illustrator and when opened in Safari I get the following error message:
error on line 11184 at column 1: Extra content at the end of the document

you've created an absolutely amazing tool, thank you soo much! I'm mainly using this code to generate .svg files for retouching Matlab figures in Inkscape.

I've just recently realized one issue I'm not sure how to handle, maybe someone else can help. I'm generating a histogram using bar(range,histogram,'histc'), where the bars have no spaces between them. However, after exporting the figure and importing it into Inkscape one can clearly see that the bars aren't touching anymore.

Any help on that would be appreciated and thanks again for your great work!

Hi, great tool! I used it a lot in the past. But is there a way to get rid of the white border (cropping) in the svg file? The way 'export_fig' (see Matlab file Exchange) does e.g.? Now I delete the border in inkscape, but if you generate many files automatically, you have to do it all over if one parameter changes.

Hi, thanks very much for this script, its the only option to export transparent patches without visual errors for me. However, I am using gridxy to draw custom grid lines. These are drawn as lines but not flagged as gridlines internally it seems [c&p from gridxy script: np = get(hca,'nextplot'); set(hca,'nextplot','add'); h = line('xdata',xx1(:),'ydata',yy1(:));].

I have set their transparency to 0.15 by adding it to the rgb triplet as 4th entry. This seems not to be checked when converting though (I cannot set GridAlpha with gridxy). I tried switching the default GridAlpha in your script from 1 to 0.15 (which actually is Matlabs default, so you may wanna update that) and at least have transparent regular (using grid on) gridlines now. I still can't use gridxy however.

Could someone with more coding knowledge than me give me a hint where in the code I would have to look to set the alpha value of regular line objects? Or even provide a solution? Thanks in advance.

Hi All,
I'm trying to save a plot with a transparent cone and a non-transparent plane. I'm using the 'hold on'-command to plot the two surfaces in one figure, but plot2svg is stacking the plots on top of each other. Therefore, one plot is covered up by the other. How can I fix this? Thanks.

For those interested, to get a transparent patch into CorelDraw, where is my process:
* create figure in MATLAB with transparent patch
* save as svg file with plot2svg
* Open in Inskape (free - Google it to download)
* Optionally, edit to remove un-needed objects
* Save as eps
* Import eps into CorelDraw

CorelDraw does not import svg (crashes), and Illustrator fails as well. Copying and pasting as metafiles from MATLAB does not work in CorelDraw or Illustrator. Exporting to pdf, either with MATLAB print command or export_fig, adn importing pdf into CoreldDraw, does not work (the patches come out as lines in the pdf). Copy from Inskape and past into CorelDraw does not work.

Has anybody found a workaround yet for the legend/colorbars not appearing as of 2014b? (I am using 2015b, but I think it came along with the major change in 2014b making legends and colorbars separate objects rather than axes)

Felipe: you can solve this issue easily by adding a new markeredgecolor case line 1579:
case 'auto' %new Matlab color schemes markeredgecolor=get(gcf,'colormap');
markeredgecolor=markeredgecolor(i,:); markeredgecolorname=searchcolor(id,markeredgecolor);
But I suggest you check Juerg's most recent version at https://github.com/jschwizer99/plot2svg

Thanks Juerg for this great tool.
Recently I'm getting this error message when trying to use plot2svg in a line plot figure:
Unsupported color handling for patches
Can you tell the reason? How to solve it?

I have a problem when plotting data at a sphere. Even if i'm plotting a white sphere inside (via surface...) in the export it looks transparent, so that also the data from the other side of the sphere is visible. Is there any way to prevent the sphere from being transparent (in Matlab itself, it is not transparent, all the alpha values are set accordingly). Thanks.

As the graphic engine of Matlab R2014b contains major changes some functionality is no more compatible. The svg format is finally supported natively. Unfortunately, the resulting files are sometimes very big. The latest version of plot2svg can be found on git

It seems the plot2svg does not support bold font for label and texts. It is said in description of the script that Latex commands are interpreted (with some limitations). I tried
text(1 ,0.5,0,'{\bf TEST}','Interpreter','latex','Rotation',90);

But it does not produce bold font. Is there any solution to produce bold font?

I experienced some problems when exporting a figure with a map containing a true color image. Upon export the "linked" image was plain empty. I could track this down to line 2024 of the code "imwrite(pointc, ..."

pointc is changed to double (n x m x 3) a few lines above. If you cast it back to uint8, the imwrite command works as expected (i.e. "imwrite(uint8(pointc), ..."

I don't know if this is a case in plot2svg, which is just not handled or maybe if the imwrite command has changed.

This will open all ".fig" files in the folder, but save all the figures with the same file name i.e. "fileName.svg". This is because "plot2svg" takes the "fileName" literally instead of taking the dynamic BASE name (without extension, a bonus) of the file from "fileName = dirListing(d).name;".

What is the workaround? How to make "plot2svg" take dynamic base name of the files?

Hey mate. Thanks for submitting such a useful function. :) I think I've found a small bug. Minor tick axes don't appear in the SVG if you are using log scale axes...They do appear in Matlab and if I export to PDF and then import into Inkscape.

Plot2svg is great. It would be even greater if it could automatically remove these parts of a plot that are masked (e.g. when limiting a plot in a subregion either with axis, xlim or ylim). This would create lighter svg plots and it would fix the problem of import svg files in some applications (e.g. scribus), as some of they take the whole area, including invisible parts, instead of what is the final visible figure. This makes the arrangement of different panels in a composed figure quite difficult.

I hope there is an easy way to do it. I definitely would appreciate it, and I guess other people too.

I recently stumbled over this and first of all, I love this package! It is truly brilliant and I especially like the WYSIWYGness of the exported SVGs.

However, this is also what I am having troubles with. I have had absolutely no problems with using plot2svg with ordinary plots. But today, I needed to use it for loglog and semilogx/semilogy plots and it does not work properly - or at least not in my opinion. I like to use "axis square" for my plots, as I like them to be square when I use them in my reports and papers. However, this creates problems when using plot2svg, especially for semilog plots, and the exported figures are squezzed together. Using "axis square" in Matlab yields a square plot, but it can have different scalings on the axes. It appears that when exporting using plot2svg, the scalings are somehow set to be equal instead of the plot dimensions being set to be equal. I would appreciate some help or a nudge in the right direction, as it is quite urgent.

Great function! I use it often. I have one suggestion though, the length of the change log makes calling help on the file completely useless. To prevent the change log from showing up during a call to help add a single un-commented empty line between the copyright information and the changelog.

(i) what does the "figuresize" argument do, it doesn't seem to be documented? exported size is controlled as described in "Plots for Scientific Publications", so what could "figuresize" be? am I not finding some documentation, perhaps?

(ii) re. "Plots for Scientific Publications", would it not be more consistent for the export size to be controlled by "PaperPosition"/"PaperUnits" rather than "Position"/"Units", since this is (as I understand it) what these "Paper..." properties are for? the way it is at the moment, the figure has to be updated on screen to affect the export size, which seems unnecessary.

A fantastic piece of software that belies the complexity of this problem. It is the only way I know of exporting transparent vector objects from MATLAB. I often find myself recommending this function to people for that reason.

Have I found a bug? When trying to plot2svg a brushed plot, I receive Error in plot2svg (line 221) ... Error in plot2svg>line2svg (line 2237) if parts(1)~=1: Attempted to access parts(1); index out of bounds because numel(parts)=0. Can anyone suggest a solution on how to export just one part of a curve? I need it for showing zoom-in's.

Thanks for sharing this. It's an important feature that should be standard in Matlab. As it is, I want to report that the suggested UTF-8 fix in the above notes is necessary for those of us using Matlab under Mac OS 10.7. Also, while I'm able to export surfaces, the camera position is not preserved.

I found the solution and mention it in here in case somebody else faces similar situation. The problem arose due to the fact that I uses:
axis([0 inf 0 10])
normally, Matlab interprets 'inf' in axis command as a hint to specify the upper bound of the axis itself, which is does and the plot is OK. But for some reason, plot2svg has an issue with that. Changing it to something like:
axis([0 5 0 10])
will fix the problem.

It is very helpful, specially for somebody like me who wants to export figures to LaTex (through inkscape). I have successfully used plot2svg for a figure and it worked perfectly, however, for another figure, I got the following message:
Matlab/Octave to SVG converter version 10-Nov-2010, Juerg Schwizer (converter@bluewin.ch).
Warning: The fourth output, VERSN, of FILEPARTS will be removed in a future release.
> In fileparts at 35
In plot2svg at 182
Warning: NaN found in Y, interpolation at undefined values
will result in undefined values.
> In interp1 at 179
In plot2svg>gridLines at 709
In plot2svg>axes2svg at 975
In plot2svg at 221

and the warning goes on and on for every 'gridline' following the first. And the output is almost empty. It is a 3x2 subplot with two titles, 6 ylabels and 2 xlabels.

Very useful for exporting high quality figures that use the fill function. Matlab really likes converting any figure that contains fill to raster, but this function exports them easily and adobe illustrator reads the files correctly.

Great work on this excellent tool! I found a small bug though, which causes images to have two color channels flipped vertically. On line 1973 "for j = size(pointc,3)" should be changed to "for j = 1:size(pointc,3)".

Bug report, with a proposed fix:
Legend text "drifts" down and left in SVG's with repeated calls to plot2svg on the same plot. This also affects the plot in MATLAB when it gets redrawn (try maximize + restore on the window).

It is caused by converting the text units to 'Data' on line 2311. Converting between the 'Data' and 'normalized' units will cause the text position value to gradually change (this can be checked by comparing get(text_handle, 'Position') before and after repeated calls to set(text_handle, 'Units', 'data') and set(text_handle, 'Units', 'normalized')).

Bug report:
When there are more than one line in the x or y label they will be written on top of each other. It creates the two lines as different text objects so the error can be corrected through inkscape.

The plot looks fine in matlab using this command:
xlabel({'this is line one', 'and line 2'})

Highly useful code! One small problem, however... for 3d plots, colors do not seem to come up correctly. Using RGB to define a green surface [0 1 0] results in a green surface in the figure, but a blue surface for the svg image... similar problems for other colors as well. Suggestions?

Yet, I found that the legend are not rendered in my SVG files. Once I guess it is because the legends are plotted outside the axes, but there is no legend rendered in my plots even I put them back inside the plots...

Many thanks for your feedback. Unfortunately, plot2svg has at the moment no support for depth sorting of graphics objects. Only depth sorting of surfaces is supported. To support an universal dept-sorting I have to design a z-buffer algorithm from scratch or use a c++/java library. Or I would need access to the Matlab internals. At the moment, my plot2svg has to generate the svg elements just from the user data. Also the svg element saving has to be changed as I need some further buffering and sorting before writing the svg file. Thus, it would be a major change.
For your application, you have to split the line into two parts and sort the elements according their z-position in the view space. There are some code fragments in the plot2svg code that do the same thing for surfaces.
I'm sorry that I can give you no better advice at the moment. Let's hope that the Matlab graphics engine itself gets some upgrading with improved support of all the new technologies like svg, filters, animation, ...
Juerg

we see a sphere with a line drawn where one part lies in front of the sphere and another part lies behind the sphere (the figure has transparency). In the matlab figure there is disctintion of those two different parts on the line colors. In the svg file we saw that there is no distinction of colors, i.e., the color of the line is the same whatever the line is ahead or behind the sphere.

There is a way to create the svg file with different colors for the objects created in front and behind the sphere? Or to make the lines behind dotted?

By far one of the most useful pieces of code I've come across. I used to trace Bezier curves on top of .png images *by hand* in a vector graphics editor to get .svg images for papers and posters. I can't even begin to describe how much time/frustration this will save me! Thanks so much!

I ran into trouble when attempting to use ImageMagick's convert command line program with an svg generated by plot2svg (e.g convert myplot.svg myplot.png). The aspect ratio of the output was way off. However when I loaded the same file in Illustrator it came out fine. Comparing Illustrator and plot2svg output, I found the following solution:

It didn't work immediately with a figure with a /patch/ (the outlines were correct but the colors didn't show up). Got it to work by switching to the /fill/ command instead. The output is exceedingly accurate compared with the eps exporters based on the painters renderer which tries to simplify/merge outlines and messes up a lot of small details. Excellent work!

Hi Felix, many thanks for the feedback! Bug 1 is already implemented together with additional tex elements. These changes will soon be published together with a minor label bugfix. I was not able to reproduce bug 2 & 3. Could you please send me an example. Many thanks. Juerg.

Great job! This really helps me plotting translucent patches, which is just not possible with matlab functions. However, there are small problems.
1: latex \cdot is not processed. I added
tex=strrep(tex,'\cdot','& # 8901;'); (without spaces...)
to line 2351 of plot2svg_beta.m
2: I have an hggroup with text objects that are placed outside of the axis (custom labels). These labels are not plotted before I set the parent of each of them to the axis.

Hi Cesar Roda Neve,
This is not a bug in plot2svg. It's a limitation of Inkscape and Firefox. Other browsers like Opera or Chrome can handle it. The SVG code for sub and super script is conform to the SVG 1.1 specification. I'm aware of the limitation and will try to find a workaround for Inkscape and Firefox.

found a little bug on line 823 of plot2svg_2d.m which was causing firefox to hit a parsing error. The original line code is
case '-.',pattern = 'stroke-dasharray="100pt,25pt,25pt,25pt,"';
which should be changed to
case '-.',pattern = 'stroke-dasharray="100pt,25pt,25pt,25pt"';
(The bug is the trailing `," after the last 25pt.)
---------------------------------------------------
There are a few issues that I'm seeing in the exported svg:
1) subscripted labels like "f(t_1,t_2)" are appearing verbatim; subscripts are not getting interpreted as I believe they should.
2) I have a figure with two 2D contour plots differentiated by one set of contours being solid and the other set dot-dashed. The svg output is unfortunately quite poor: one can hardly make out that there are two sets of contours.
----------------
For (1) above I have an idea: SVG+MathML
I am using MathML to render a table of parameters -- which requires some math typesetting, greek symbols, matrices -- to go along with the plots. The way I am doing that is to have tex (well, itex actually) markup in the file and pass the file through itex2MML.
Maybe the same process will work with the svg figures. Enclose the math in the labels in a pair of
`$"s (requited by itex), set Matlab's Interpreter to Latex so that the fig file comes out alright, create an svg and filter through itex2MML. Let's see how that goes.
If only Matlab had native SVG support, wouldn't have to jum through all these hoops...

Sorry, kind of screwed up there - what I was trying to do was plot a handle that comes from a call to the polar(...) command. plot2svg works fine for figure handles. I retract my fix, but not the whole dying-without-plot2svg thing.

By the way, this is the most awesome and necessary script I've ever used. When it stopped working I wanted to die and thought the world around me was crumbling to pieces, leaving me shattered and vulnerable to the cruel biddings of Adobe Illustrator.

But now those days are over, I can breathe a breath of joy knowing that I can continue to use Inkscape for making figures! Hurrah!

I experienced the same problem and solved it by replacing lines 1121 and 1130 :
group=axchild2svg(fid,id,axIdString,ax,group,paperpos,get(axchild(i), 'Children'),axpos,groupax);
by
group=axchild2svg(fid,id,axIdString,ax,group,paperpos,get(axchild(i), 'Children'),axpos,groupax,projection);

How long will it take The Mathworks to include this functionality in Matlab by default?! It has been asked multiple times and would be a BIG plus considering the growing support for the format, both closed and open source.

Just wondering... big thumbs up for the author of this export script!

Mazen Saied

12 Sep 2008

Hello,

Great work and congratulations for this macro. I have found a bug to correct. It concerns surface intersections when you plot 2 or more surfaces (surf, mesh, ...). I notices that when you export in SVG format, plotted surfaces are stacked one on the other and their intersections disappear.

Nevertheless, all the rest is perfect.
Thank you

sylvain lalure

2 Sep 2008

Dmitry Babin

24 May 2008

A correction to my previous post (from 2008-05-15):

1. LaTeX commands ARE interpreted, but only when enclosed by curly braces. For example:
xlabel('\bft\rm, [sec]')
isn't interpreted correctly;
xlabel('{\bft}, [sec]')
is OK.

2. About "surf" and "mesh" plots: my mistake... I tried to use it in this way:
h = surf(.........)
plot2svg('filename.svg',h)
The correct way to get a handle is:
h = figure(1)
surf(.........)
plot2svg('filename.svg',h)

Mat Hunt

18 May 2008

Interoperability with octave would also be a good idea, I get the error message (with octave):
Matlab to SVG converter version 22-Jan-2006, Juerg Schwizer (converter@juergs
chwizer.de).
Warning: Future versions may no more support older versions than MATLAB R12.
error: `uiputfile' undefined near line 52 column 29
error: evaluating if command near line 51, column 1
error: called from `plot2svg' in file `/home/mat/plot2svg.m'

Dmitry Babin

15 May 2008

Bug report (MATLAB R2008a, not tested with older versions):
1. LaTeX commands are not interpreted (e.g. \bf appears in SVG text strings)
2. When trying to use it with surf plots, the following error message appears:

??? Error using ==> get
There is no 'Units' property in the 'surfaceplot' class.

Error in ==> plot2svg at 87
originalFigureUnits=get(id,'Units');

nino guttuso

24 Apr 2008

Jason Merrill

10 Mar 2008

This is fantastic. I think this may allow me to dump Illustrator in favor of Inkscape. One cross-platform thing: on Unix/Mac, files always get saved with an extra backslash in front of them. A quick fix is to replace the explicit string '/' with filesep in the addBackSlash subfunction (lines 1652-1653 in plot2svg, and lines 1232-1233 in plot2svg_2d). Here's the corrected version:

function strString=addBackSlash( strSlash)
% adds a backslash at the last position of the string (if not already there)
if ( strSlash(end) ~= filesep)
strString = [ strSlash filesep];
else
strString = strSlash;
end

I suspect this could all be cleaned up (i.e. you wouldn't even need the addBackSlash function) using the fullfile function.

r. h.

7 Feb 2008

Bug report. Used without arguments.

??? Attempted to access cdata(2,:); index out of bounds because size(cdata)=[1,21].

This is a great script! Thank you for making it.
I use inkscape to edit the svg files and I find the following issues:

1. I need to hand code the font into the file (i.e. I need to force
textfontname = 'Arial';
)

2. I need to remove the "pt" from all the font size descriptions

Thanks
-Kaushik

Sam R

18 Dec 2007

This is excellent. Matlab allows you to save figures in illustrator's format, but it does not handle transparency of 3D planes. This script does and makes it possible to have a vectorial file of 3D surfaces with transparency. Thanks!

Geoff Adams

7 Nov 2007

Very nice function. However, I believe I have found a bug. On line 1121, "axchild2svg" is called without the "projection" argument. Adding it in seems to fix the problem. So to fix the bug:

Great tool for exporting graphs to Inkscape!
Get an error when making a plot using errorbar:
"??? Input argument "projection" is undefined.Error in ==> plot2svg>axchild2svg at 706 [x,y,z] = project(linex,liney,linez,projection);
Error in ==> plot2svg>axchild2svg at 1121 group=axchild2svg(fid,id,axIdString,ax,group,paperpos,get(axchild(i), 'Children'),axpos,groupax);
Error in ==> plot2svg>axes2svg at 459
group = axchild2svg(fid,id,axIdString,ax,group,paperpos,axchild,axpos,groupax,projection);
Error in ==> plot2svg at 139 group=axes2svg(fid,id,ax(j),group,paperpos);"

Anybody an idea for a workaround?

bassam atallah

25 Jun 2007

Great little application. It is helpful. A few comments.
Doesn't seem to deal correctly with:
1) When background axis 'Color' is set to 'none' (you get a none white background)
2) Doesn't support histogram plots in the form of 'bar' or 'stairs'

PONTHEP VENGSUNGNLE

21 Jun 2007

Great job,It is very interesting
Thank for good experience
From thailand

bahram houchmandzadeh

6 Jun 2007

Great work. For must stuff we do, matlab plots are not that sophisticated and the package just works.

Jean-Francois Dupuis

1 May 2007

To handle bar plot, just use the backward compatibility flag such as : bar('v6', ...);

J. V.

5 Mar 2007

Hi

I don't see why doesn't Matlab have an "export to SVG" option yet. Juerg Schwizer did a great job, but it is too much for a single person to implement the full support for SVG.

It works ok for simple graphics. But it fails with transparencies and flat FaceColor. Take the example in the documentation for the "patch" command

Works well for the most part. Gives an error and doesn't converst bar graphs though.

phox hat

8 Feb 2007

Just what I needed!

Benjamin Watts

19 Jan 2007

Excellent function, I will use this alot!

Bug: setting XTick with any numbers outside of the set xlim in the figure will cause an error in plot2svg.

S. Barth

6 Nov 2006

Great! Spent too much time to find something comparable.

Monsieur Truc

18 Oct 2006

Thanks, this is great and should be implemented natively in Matlab.
Tip : if you want smaller files, convert the multilines objects (curves...) into pathes with inkscape and use the 'simplify' tool.

Timothy Withheld

14 Jun 2006

this piece of code is amazing. the svg exports work perfect with inkscape which is _exactly_ what i needed.

Kris De Gussem

2 May 2006

Should be part of Matlab itself

m m

24 Feb 2006

Get confused if you manually alter the axis scales: e.g. Inkscape still reports layers of the 'original' size I think. Also non-size preserving in pixels at the least. Needs specifically size setting in e.g. Inkscape before external users will recognise the pixel size settings. Otherwise, very goodl

Yordan Kyosev

21 Feb 2006

Thank you Juerg!

E Dinnat

10 Feb 2006

Just tried the 3D functionality on a few samples. Works great. Excellent and very usefull function. Too bad light is not exported and interpolated shading is not excellent, but I guess that SVG (or any vector format) isn't suited for so complex rendering.

Ken Senior

21 Jan 2006

Running the plot2svg command on my Windows XP R14SP3 gives the error:
??? Error: File: plot2svg.m Line: 1763 Column: 1
The function "get_projection" was closed
with an 'end', but at least one other function definition was not.
To avoid confusion when using nested functions,
it is illegal to use both conventions in the same file.

Wladimir van der Laan

7 Nov 2005

You just saved my day :-) I tried so many things, like exporting .ai and trying to import it in inkscape, but it all yielded corrupted plots or nothing at all. With this program, it works perfectly.

Matthias Schabel

6 Nov 2005

Very nice work. Default plot size appears quite small when imported into Illustrator - 400% magnification required to make image fit standard page. Otherwise great help for preparing plots for publication.

Charlie Eckelston

1 Nov 2005

Great tool for editing plots for publications

tom mod

1 Nov 2005

Heiko Marx

30 May 2005

Nice! What I first found was that for zoomed plots the data exceeds the plot area. And the files become quite large. And having lots of controls causes having lots of jpegs. But because we use the .svg-format very often, this is a very useful tool with a lot of potential! Thank you!

- Bugfix for ticklabels outside of the axis limits
- Enabled scatter plots using hggroups
- Closing patches if they do not contain NaNs
- Support of the 'Layer' keyword to but the grid on top of
of the other axis content using 'top'

6 Mar 2010

1.5

Bugfixes and support of user requests. See 'Changes in Version 06-Mar-2010' for more information.

16 Aug 2009

1.4

- Bug fixes for text size / line distance
- Support of background box for text
- Improved support of filters
- Experimental support of animations
- Rework of latex string handling
- 'sub' and 'super' workaround for Firefox and Inkscape