Exemple #1
0
# Enthought library imports
from chaco.shell import show, title, plot, pcolor, colormap, curplot
from chaco.default_colormaps import jet

# Crate some scalar data
xs = linspace(0,10,200)
ys = linspace(0,20,400)
x,y = meshgrid(xs,ys)
z = sin(x)*y

# Create a pseudo-color-map
pcolor(x,y,z)

#change the color mapping
colormap(jet)

# Add some titles
title("pseudo colormap image plot")

# Add a custom tool - in this case, an ImageInspector
from chaco.tools.api import ImageInspectorTool, ImageInspectorOverlay
img_plot = curplot().plots.values()[0][0]
tool = ImageInspectorTool(img_plot)
img_plot.tools.append(tool)
overlay = ImageInspectorOverlay(img_plot, image_inspector=tool,
                                bgcolor="white", border_visible=True)
img_plot.overlays.append(overlay)

#This command is only necessary if running from command line
show()
Exemple #2
0
xs = linspace(0, 10, 200)
ys = linspace(0, 20, 400)
x, y = meshgrid(xs, ys)
z = sin(x) * y

# Create a pseudo-color-map
pcolor(x, y, z, name='sin_x_times_y')

# Change the color mapping
colormap(jet)

# Add some titles
title("pseudo colormap image plot")

# From the current plot object, grab the first plot
img_plot = curplot().plots['sin_x_times_y'][0]

# Add a custom tool - in this case, an ImageInspector
from chaco.tools.api import ImageInspectorTool, ImageInspectorOverlay

tool = ImageInspectorTool(img_plot)
img_plot.tools.append(tool)
overlay = ImageInspectorOverlay(img_plot,
                                image_inspector=tool,
                                bgcolor="white",
                                border_visible=True)
img_plot.overlays.append(overlay)

# If running this from the command line and outside of a wxPython
# application or process, the show() command is necessary to keep
# the plot from disappearing instantly.  If a wxPython mainloop
# Major library imports
from numpy import linspace, pi, sin

# Enthought library imports
from chaco.shell import show, plot, title, curplot
from chaco.scales.api import CalendarScaleSystem

# Create some data
numpoints = 100
x = linspace(-2 * pi, 2 * pi, numpoints)
y1 = sin(x)

# Create the dates
import time
now = time.time()
dt = 24 * 3600  # data points are spaced by 1 day
dates = linspace(now, now + numpoints * dt, numpoints)

# Create some line plots
plot(dates, y1, "b-", bgcolor="white")

# Add some titles
title("Plotting Dates")

# Set the plot's horizontal axis to be a time scale
curplot().x_axis.tick_generator.scale = CalendarScaleSystem()

#This command is only necessary if running from command line
show()
Exemple #4
0
ys = linspace(0,20,400)
x,y = meshgrid(xs,ys)
z = sin(x)*y

# Create a pseudo-color-map
pcolor(x, y, z, name='sin_x_times_y')

# Change the color mapping
colormap(jet)

# Add some titles
title("pseudo colormap image plot")


# From the current plot object, grab the first plot
img_plot = curplot().plots['sin_x_times_y'][0]

# Add a custom tool - in this case, an ImageInspector
from chaco.tools.api import ImageInspectorTool, ImageInspectorOverlay

tool = ImageInspectorTool(img_plot)
img_plot.tools.append(tool)
overlay = ImageInspectorOverlay(img_plot, image_inspector=tool,
                                bgcolor="white", border_visible=True)
img_plot.overlays.append(overlay)


# If running this from the command line and outside of a wxPython
# application or process, the show() command is necessary to keep
# the plot from disappearing instantly.  If a wxPython mainloop
# is already running, then this command is not necessary.
Exemple #5
0
# Major library imports
from numpy import linspace, pi, sin

# Enthought library imports
from chaco.shell import show, plot, title, curplot
from chaco.scales.api import CalendarScaleSystem

# Create some data
numpoints = 100
x = linspace(-2*pi, 2*pi, numpoints)
y1 = sin(x)

# Create the dates
import time
now = time.time()
dt = 24 * 3600    # data points are spaced by 1 day
dates = linspace(now, now + numpoints*dt, numpoints)

# Create some line plots
plot(dates, y1, "b-", bgcolor="white")

# Add some titles
title("Plotting Dates")

# Set the plot's horizontal axis to be a time scale
curplot().x_axis.tick_generator.scale = CalendarScaleSystem()

#This command is only necessary if running from command line
show()

Exemple #6
0
# Create some data
numpoints = 100
x = linspace(-2*pi, 2*pi, numpoints)
y1 = sin(x)

# Create the dates
import time
now = time.time()
dt = 24 * 3600    # data points are spaced by 1 day
dates = linspace(now, now + numpoints*dt, numpoints)

# Create some line plots
plot(dates, y1, "b-", bgcolor="white")

# Add some titles
title("Plotting Dates")

current_plot = curplot()
# Set the plot's horizontal axis to be a time scale
current_plot.x_axis.tick_generator.scale = CalendarScaleSystem()
zoom_tool = current_plot.overlays[2]
pan_tool = current_plot.tools[0]
zoom_tool.x_min_zoom_factor = float(1e-3)
pan_tool.restrict_to_data = True


# This command is only necessary if running from command line
show()