Changeset 6661 for trunk/examples


Ignore:
Timestamp:
Dec 9, 2016, 10:44:46 AM (8 years ago)
Author:
dkearney
Message:

adding example of using axis limits on curves

Location:
trunk/examples/zoo/curve
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/zoo/curve/curve.py

    r5681 r6661  
    3939# single['component.xy'] = [x, y]
    4040# single['component.xy'] = np.row_stack((x, y))
     41
     42# generate a single curve with x and y axis upper and lower limits
     43xminl = xmin+((xmax-xmin)/4.0)
     44xmaxl = xmax-((xmax-xmin)/4.0)
     45yminl = np.cos(xminl)/(1+xminl)
     46ymaxl = np.cos(xmaxl)/(1+xmaxl)
     47limited = rx['output.curve(limited)']
     48limited['about.label'] = "Axis limits curve"
     49limited['about.description'] = \
     50    'This is an example of a single curve with x and y axis limits applied.'
     51limited['xaxis.label'] = "Time"
     52limited['xaxis.description'] = "Time during the experiment."
     53limited['xaxis.units'] = "s"
     54limited['xaxis.min'] = xminl
     55limited['xaxis.max'] = xmaxl
     56limited['yaxis.label'] = "Voltage v(11)"
     57limited['yaxis.description'] = "Output from the amplifier."
     58limited['yaxis.units'] = "V"
     59limited['yaxis.min'] = yminl
     60limited['yaxis.max'] = ymaxl
     61
     62# plot it
     63limited['component.xy'] = (x, y)
     64
    4165
    4266# generate multiple curves on the same plot
  • trunk/examples/zoo/curve/curve.tcl

    r3911 r6661  
    3333    $driver put -append yes output.curve(single).component.xy "$x $y\n"
    3434}
     35
     36# generate a single curve with x and y axis upper and lower limits
     37set xminl [expr $min+(($max-$min)/4.0)]
     38set xmaxl [expr $max-(($max-$min)/4.0)]
     39set yminl [expr {cos($xminl)/(1+$xminl)}]
     40set ymaxl [expr {cos($xmaxl)/(1+$xmaxl)}]
     41
     42$driver put output.curve(limited).about.label "Axis limits curve"
     43$driver put output.curve(limited).about.description \
     44    "This is an example of a single curve with x and y axis limits applied."
     45$driver put output.curve(limited).xaxis.label "Time"
     46$driver put output.curve(limited).xaxis.description "Time during the experiment."
     47$driver put output.curve(limited).xaxis.units "s"
     48$driver put output.curve(limited).xaxis.min $xminl
     49$driver put output.curve(limited).xaxis.max $xmaxl
     50$driver put output.curve(limited).yaxis.label "Voltage v(11)"
     51$driver put output.curve(limited).yaxis.description "Output from the amplifier."
     52$driver put output.curve(limited).yaxis.units "V"
     53$driver put output.curve(limited).yaxis.min $yminl
     54$driver put output.curve(limited).yaxis.max $ymaxl
     55
     56for {set x $min} {$x < $max} {set x [expr {$x+$dx}]} {
     57    set y [expr {cos($x)/(1+$x)}]
     58    $driver put -append yes output.curve(limited).component.xy "$x $y\n"
     59}
     60
    3561
    3662# generate multiple curves on the same plot
Note: See TracChangeset for help on using the changeset viewer.