Rank: 1842 based on 64 downloads (last 30 days) and 3 files submitted
photo

Johan Carlson

E-mail
Company/University
LuleƄ University of Technology

Personal Profile:

MATLAB user/addict since approx. 1996, way back when GUI programming was done in Notepad or Emacs and serial port communications had to be done via MEX file interfaces.

Working mostly with measurement technology applications in general, with a special interest in signal processing, modeling and parameter estimation.

Always implementing the whole chain in MATLAB, from data acquisition to visualization of results.

Professional Interests:
Ultrasonic measurement technologies, Signal processing, System identification, Process modeling

 

Watch this Author's files

 

Files Posted by Johan View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
21 Nov 2009 Screenshot Centered coordinate axes in 2D plots Takes the current coordinate axes (with ticks and labels) and draws new ones centered at the origin. Author: Johan Carlson plot, plotting, axes, graph, origin, graph2d 23 6
  • 3.5
3.5 | 2 ratings
12 May 2009 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson plotting, plot legend, plot augmentation, graphics, plot, legend 29 11
  • 5.0
5.0 | 7 ratings
15 Nov 2008 audiorec.m Recording of short transients based on input level triggering. Author: Johan Carlson audio recording, analog input, measurement 12 0
Comments and Ratings by Johan View all
Updated File Comments Rating
28 Apr 2013 Centered coordinate axes in 2D plots Takes the current coordinate axes (with ticks and labels) and draws new ones centered at the origin. Author: Johan Carlson

Glad you liked it! Never tried doing it for 3D, but in principle you should be able to hack the code to do it.

07 Feb 2012 Rotate X-axis tick labels Rotate x-tick labels to any angle, preserving font settings and coping with resize, zoom, pan etc Author: Ben Tordoff

Hi,
On screen everything looks fine. However, when I try to print, the tick labels disappear, same as for Wolfgang. I'm running MATLAB 2011b (7.13.0.564) on Windows 7 (x64 version). All plot settings are at the default.

Other than that, great function!
/Johan

Here's the test script that used:

%------------------
clear all
close all
clc

x = 1:0.2:2.8;
y = x.^2;
plot(x,y);
xlab = get(gca,'XTickLabel');
xlab = num2str(xlab);
set(gca,'XTickLabel',xlab);
xlabel('X axis label');
ylabel('Y axis label');
title('Plot title');
rotateXLabels(gca, 45)
set(gcf, 'PaperPositionMode', 'auto');
print('-dpng','plot.png');

27 Oct 2011 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson

It appears MATLAB does not save exactly what has been drawn, but some command that should recreate it, in this case the legend command. So, re-running the legend command will of course destroy the changes made by legendlinestyles.m

A workaround would be to save the code you used to create the plot, rather than the fig itself. This is what I always do, which is probably why I never ran into this problem.

So, my conclusion is that this is a problem with how MATLAB saves figures, not with legendlinestyles.m as such. Will play around with some other legend changes, though, and see where it takes me.

27 Oct 2011 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson

If I print (or export) figures to, for example, .eps, everything works. If I save to a .fig file, I get the same error. Very strange, indeed, and I'm not even sure where to start looking. It's like MATLAB arbitrarily discards of some of the manually entered annotations.

Anyway, will look into it. Please keep me posted if you find a solutions.

/JC

21 Nov 2009 Centered coordinate axes in 2D plots Takes the current coordinate axes (with ticks and labels) and draws new ones centered at the origin. Author: Johan Carlson

Mario,
I deliberately removed the end tick labels in on the axes, simply because I didn't think it looked so good. It appeared that changing this takes a bit of fixing of the code to make the arrowheads appear in the right place. Anyway, I'm on it, and I'll post a new version in a couple of days.

/JC

Comments and Ratings on Johan's Files View all
Updated File Comment by Comments Rating
28 Apr 2013 Centered coordinate axes in 2D plots Takes the current coordinate axes (with ticks and labels) and draws new ones centered at the origin. Author: Johan Carlson Carlson, Johan

Glad you liked it! Never tried doing it for 3D, but in principle you should be able to hack the code to do it.

27 Apr 2013 Centered coordinate axes in 2D plots Takes the current coordinate axes (with ticks and labels) and draws new ones centered at the origin. Author: Johan Carlson jokulhlaup

This is a great bit of code and just what I needed.

Is there a simple way to make this work in 3D?

13 Aug 2012 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson Pearl

just what I needed! Thank you.

13 Dec 2011 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson Steven

It was easy enough to add this myself, but it'd be nice to let the user specify the linewidth. I used this on a plot with several different line widths making the results unpredictable with the current program. Sometimes I would like to have all the same linewidths in the legend.

Otherwise, this was exactly what I've been looking for. Thanks!

13 Dec 2011 Edit linestyles of plot legends Simple fix for adding markers to plot legend lines. Author: Johan Carlson Steven

Contact us