transparent background in figure (matlab) - matlab

I'd like to save a matlab figure with transparent background, on mac, and import into Keynote.
This question was asked in 2013, but I understand matlab has changed its graphics handling since then. Is there a 'good' way to do this? The plotting syntax is so scattered and overloaded.

I looked for this myself some time ago. Mathworks seems to state that this is not directly possible in matlab and that it isn't a feature they plan on introducing as well:
http://ch.mathworks.com/matlabcentral/answers/19907-transparent-background-for-figures
But as stated in the link it can easily be achieved using a third-party program (for example inkscape, which is freeware(opensource?) program) if you export the figure as a .eps or .pdf. This basically enables you to directly edit or delete certain parts of the image.
This is probably not exactly what you were looking for, but I know of no easier native solution than this. However the author refers to export_fig which might directly solve you porblem (I don't have any experience using it, sorry).

Related

Is there a way to draw multi-page mind map diagrams with PlantUML?

I have tried using different MindMap diagrams and it looks like this field didn't get enough attention in software development community, so I cannot find enough info on other resources.
Anyway, I use PlantUML to draw Mind Map diagram. The issue is that I draw it from the website, so it gets nested to 6th level and deeper. In PlantUML I can use it either as plain PlantUML or save as PNG file. (It doesn't seem support other formats)
There are several questions but the main is, how can I save/split it as a multi-page?
Sub-questions which also can be answers in my case, how to organise Mind Map to make it readable in PNG? How to keep it on single PNG? Are there other formats supported?
NOTE:
Even though this question asks about specific tool (PlantUML), this question touches fundamental question. I struggle to have this peace ready in my software and it is crucial part before the release.
UPDATE 1:
Here is example of the PNG file I receive after conversion .puml to .png:
NOTE: The .puml file was too long for plantuml.com to render. The length of the file is 16754 lines.
As I wrote in my comment above, SVG representations of a large Mind Map might be more easily navigated:
Try PlantUML using VSCode and this extension: https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml
If you use Local rendering (you have to install PlantUML and configure it on your local machine) you can use large diagrams and produce SVG output. I don't use the IntelliJ plug-in, so I'm not sure if you can also generate SVG with it.

Publishing a .m matlab file to pdf: display latex is blurred / poor quality

I'm using the command publish('myFile.m', 'pdf') within the Matlab gui. The resulting file is crisp and perfect except for any of the LaTex within it which is blurred almost to the point of not being readable. Where do you think the source of this issue is? Are there any workarounds?
Context: I'm using Matlab 2014a on a macbook pro retina. Problem persists for all other generation: issue is with the .png
Note: The whole GUI was completely blurred on install. I have since updated the version of java being used by Matlab using this solution:
cd /Applications/MATLAB_R2013b.app/sys/java/jre/maci64
mv jre jre.orig
ln -s /Library/Java/JavaVirtualMachines/jdk{jdk.version}.jdk/Contents/Home/jre
Linked unanswered question
Answer from Matlab Support
Hello James,
I am writing in reference to your Technical Support Case #01107596
regarding 'LaTex rendering in very low quality when publishing'.
I apologize for the inconvenience you experience. Unfortunately what
you observe is a bug in the way that "publish" renders LaTeX equations
when publishing to .pdf. At the moment there is no direct work-around
for it.
The best indirect work-around is to publish to LaTeX instead of .pdf
and then compile the resulting TeX file using a LaTeX compiler. I
appreciate that this work-flow is sub-optimal. The relevant
development team is already notified about it.
I hope this e-mail clarifies the issue you experience. Once again I am
really sorry for this inconvenience. I will now close this service
request as having a bug report submitted but I will reopen it if you
require further clarifications. Do not hesitate to contact us again if
you have a new query regarding MATLAB's functionality.
Please preserve the Reference ID below in further correspondence on
this query. This allows our systems to automatically associate your
reply to the appropriate Case.
If you have a new technical support question, please submit a new
request here:
http://www.mathworks.com/support/servicerequests/create.html

Converting Matlab GUI into a guide GUI

I have inherited a pile of Matlab scripts that manually build a GUI using calls to uicontrol, uimenu, etc. Over the years we have needed to remove and add elements to the GUI and since all the positions are specified manually in the scripts, the layout hasn't really changed to accommodate the missing elements so it is really starting to look like a pile of trash.
Is there a way to automatically convert my matlab scripted gui into something I can use with guide? I would rather not have to start over...
GUIs generated with GUIDE are not much better than manually scripted ones (if not worse in my opinion in terms of maintainability).
The sad truth is that there are no builtin layout managers in MATLAB (there are user-contributed ones on FEX like border layout, gridbag layout and others). If you are refactoring the code, please consider using some sort of GUI layout manager.
To answer your question, afaik there is no automatic tool for such a conversion.
To be exact, MATLAB has some undocumented layout managers: uiflowcontainer and uigridcontainer. See this article by Yair Altman
Well, there is no automatic conversion utility but you dont need to create everything from scratch with GUIDE.
Execute your GUI so that it shows up and save the figure window as a fig file. This file then can be edited with guide.
However this needs manual adjustments in your code. Especially if you need access to handles and I am also not sure about the callback functions.
However, as Amro already pointed out, GUIDE is not a perfect solution.

Vector graphics library for Common Lisp

Could someone suggest a good library for vector graphics?
Several libraries support drawing shapes, what I need is a library that can save to a vector format.
edit:
I must admit I didn't do enough googling before posting.
cl-vectors seems to be maintained, advanced and documented.
vecto seems to be maintained, advanced-enough and documented-enough interface for it
Still I am used to cl libraries not being what they seem, so if anyone has some personal experience, please share
Besides CL-SVG, CL-PDF seems to be another option.
EDIT: another recommendation
I've looked further into the subject, since I'm interested in this myself, and found one library that supports both saving to files (PS, PDF, SVG, and PNG) and drawing on the screen (GTK2 and X11): cl-cairo2. It seems really the best choice if you need both and aren't already bound to another windowing library.
I have very positive experience with vecto, but I used it for generating PNG files (various graphs). It's quite easy to use and user-friendly. But, as far as I know, it can't save to any vector format.
If you want to write to some vector format, CL-SVG is, probably, the only reasonable choice, but I didn't try it.

Matlab Vs. Maple for curve fitting to data, finding eq'n of curve then integrating through code

Im sure there are a thousand different posts on Maple vs Matlab, but i have a bit of a unique set of requirements and before i go off to learn one of the two i would like to know which one will do it best.
I have a set of data from an accelerometer recording an impact. I need to do the following:
fit a curve to the data
Find the equation for that curve
solve the equation listed at the link
http://upload.wikimedia.org/wikipedia/en/math/2/d/3/2d39556df1dbbd467dc914253e93cdb0.png
which solves for a family of curves,i.e the MAX under the interval.
I would like to do this as seamlessly with visual studio as possible. The GUI and all the other elements of the app are built in VB and I would like to keep it there. I know maple has a code generating part to it that will convert to VB, would it be able to handle something like this? Does Matlab integrate with Visual Studio well? I would be thrilled if there was an object i could place on the VB form which would facilitate the communication to and from the matlab or maple framework. Currently i have it working with R, however to do so i need to write the data to a file, launch the R script, wait for it to finish, return control to my VB app and take it from there. This process takes too long and since i do not have experience with multi threaded programming the GUI freezes up when control is passed to the script.
Any help or suggestions would be very much appreciated!
In your case I would choose neither of the two. You may have a look at Python Tools for Visual Studio. The blog post mentions support for NumPy & SciPy for .Net which gives you all the math power you need at hand well integrated in the .Net world.
EDIT:
By looking at matplotlib's gallery I'm tempted to say that matplotlib is on par with MATLAB.
MATLAB doesn't auto-generate VB code, but it can easily be called from a VB application without the indirection of writing a file. It has COM interface that can be called directly from within VB code. See this example from the MATLAB documentation to find out more.
To carry out the technical analysis you've mentioned, you would probably save time by using Curve Fitting Toolbox in addition to base MATLAB.
Note that the above method of connecting to MATLAB via its COM interface relies on there being a live copy of MATLAB present when the VB application is executed. If you need to share your application with people who don't have a copy of MATLAB, you can also create standalone COM components and .NET assemblies from MATLAB code that can be called in the same way by your VB code, but can be deployed freely to people without a MATLAB license - however, this requires an extra product, MATLAB Builder for .NET.