help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subplot and Legend


From: pantxo diribarne
Subject: Re: Subplot and Legend
Date: Thu, 19 Apr 2012 09:52:14 +0200

Hi,

Does this do the job?

## styles to be used
styles = {"-or", "-*k", ":^b", "-vg"};

## real subplot data
for ii = 1:4
  subplot (2, 2, ii);
  plot(1:10, styles{ii})
endfor

## dummy axes
tmp = axes (); hold on;
dumx = -1000;
dumy = -1000;

for ii = 1:4
  plot(dumx, dumy, styles{ii})
endfor

legend (styles, "location", "northoutside", "orientation", "horizontal")
axis ([1 2 1 2])
axis ("off")  ## hides the axes lines only

Pantxo

I forgot, to mension that :

- @Ben : copyobj won't do the job, it can't copy a legend without its corresponding axes, and it finally creates a legend that will (should) behave as the original.
- @Juan : to make a legend behave like an ordinary axes (at least for "position") you can change "tag" and "userdata" properties (with "lg" the legend handle ) :
set (lg, "tag", "")
set (lg, "userdata", [])
set (lg, "position", [x0 y0 width height])

Pantxo
reply via email to

[Prev in Thread] Current Thread [Next in Thread]