help-octave
[Top][All Lists]
Advanced

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

Second axis (second-x or second y-axis, x2y1, y2x1, etc.)


From: Stefan Pofahl
Subject: Second axis (second-x or second y-axis, x2y1, y2x1, etc.)
Date: Thu, 5 Feb 2009 22:59:33 +0100

Hello,

is there a chance to tell octave to use the second axis?
I can export the data in text file an can plot it with gnuplot,
but perhaps there is a more clever way, I invetigated the
object "line" (child of object "axis") to find a way to do it,
Isearched the mailing lists and found only the advice to
use gplot.
So is there a chance to tell the object "line" that it belongs
e.g. to x1y2?

Attached I send you my test function to invetigate the
topic. I hope it is of interest for newcomers.

Regards,

Stefan

-- 
Tel.: 0731-3805149
Ochsensteige 48
89075 Ulm
Germany

__________________________________________________________________
__________________________________________________________________

function test_set_and_get_command()
  clf();
# Get Handle of "line"
  line_hdl = plot(0);
# Get Handle of axes
  axes_hdl = gca();

# Investigate Object Properties of Object axes
  clc;
  disp("");
  disp("Investigate Object Properties of Object axes")
  printf("%s\n","get(gca()) or axes_hdl = gca(); get(axes_hdl)");
  get(axes_hdl)
# 
-------------------------------------------------------------------------------
  
printf("-------------------------------------------------------------------\n");
  
printf("-------------------------------------------------------------------\n");
#  disp("First hit q (quit) and than another key");
#  pause();
# ---
  clc;
  disp("");
  disp("Investigate Object Properties of Object axes, child 'Title'")
  printf("%s\n","title_hdl = get(axes_hdl, ""title""):");
  title_hdl = get(axes_hdl, "title")
  printf("%s\n","get(title_hdl):");
  get(title_hdl)
# 
-------------------------------------------------------------------------------
  
printf("-------------------------------------------------------------------\n");
  
printf("-------------------------------------------------------------------\n");
#  disp("Hit any key");
#  pause();
# ---
  disp("");
  printf("%s\n","Investigate Properties of Object 'axes', child 'children'");
  printf("%s\n","children_hdl = get(axes_hdl, ""children""):");
  children_hdl = get(axes_hdl, "children")
  printf("%s\n","get(children_hdl):");
  get(children_hdl)
# 
-------------------------------------------------------------------------------
  
printf("-------------------------------------------------------------------\n");
  
printf("-------------------------------------------------------------------\n");
#  disp("Hit any key");
#  pause;

# --- Investigate Properties of Object "line"
  clc;
  disp("");
  printf("%s\n","Investigate Properties of Object 'line':");
  get(line_hdl)
# 
-------------------------------------------------------------------------------
  
printf("-------------------------------------------------------------------\n");
  
printf("-------------------------------------------------------------------\n");
#  disp("Hit any key");
#  pause;
# ---
  clc;
  disp("");
  printf("%s\n","Investigate property 'keylabel' of object 'line':");
  get(line_hdl, "keylabel")
# 
-------------------------------------------------------------------------------
  
printf("-------------------------------------------------------------------\n");
  
printf("-------------------------------------------------------------------\n");
#  disp("Hit any key")
#  pause;

####################################################################################
####################################################################################
## Now comes a real plot:

  X=(0.25:0.01:0.72)';
  Y1= X.^-2.5/2;
  Y2= X.^-3/2;
  Y3= X.^-3.5/2;
  Y4= X.^-4/2;

# Get Handle of "line"
  line_hdl = plot(X,Y1,";Y1;",X,Y2,";Y2;",X,Y3,";Y3;",X,Y4,";Y4;");
# Get Handle of axes
  axes_hdl = gca();
#
  printf("%s\n","Investigate property 'keylabel' of object 'line':");
  get(line_hdl, "keylabel")


# Set axis properties (two way are possible):
  set(gca(), "key", "on");
  set(axes_hdl, "key", "on");
# "title", is a child of object "axis" and has its own handle:
  set(title_hdl, "string", "Plot Title")

# Set line properties, if one axis objects hold more than one child
# children are the lines, than the handle variable is vector:
  printf("%s\n","In a next step we change the ""line-labels"":");
  for i = 1:size(line_hdl)
    keylabel = ["keylabel: ", num2str(i,"%2.2i")];
    set(line_hdl(i), "keylabel", keylabel);
  endfor

  
printf("-------------------------------------------------------------------\n");


#  plot into a file ('e:' is disk specification is MS-Windows style)
  my_string = "e:/TEMP/foo2.ps";
  printf("my_string: %s\n", my_string)
  print(my_string, '-landscape', '-dps');

endfunction


reply via email to

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