Ticket #2655 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Allow curves to be manipulated in Python

Reported by: Nick Draper Owned by: Russell Taylor
Priority: major Milestone: Release 2.0
Component: MantidPlot Keywords:
Cc: Blocked By:
Blocking: Tester: Peter Parker

Description

From QTIPLOT handbook:

All the curves in a plot layer can be customized in terms of color, line width and line style. Here's a short script showing the corresponding functions at work:

t = newTable("test", 30, 4)
for i in range(1, t.numRows()+1):
	t.setCell(1, i, i)
	t.setCell(2, i, i)
	t.setCell(3, i, i+2)
	t.setCell(4, i, i+4)

l = plot(t, (2,3,4), Layer.Line).activeLayer() # plot columns 2, 3 and 4
for i in range(0, l.numCurves()):
	l.setCurveLineColor(i, 1 + i) #curve color is defined as an integer value
	l.setCurveLineWidth(i, 0.5 + 2*i)

l.setCurveLineStyle(1, QtCore.Qt.DotLine)
l.setCurveLineStyle(2, QtCore.Qt.DashLine)

Change History

comment:1 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 28 to Iteration 29

Bulk move of tickets at the end of iteration 28

comment:2 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

"New" tickets moved at the code freeze of iteration 29

comment:3 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 30 to Iteration 31

Bulk move of tickets to iteration 31 at the iteration 30 code freeze

comment:4 Changed 9 years ago by Russell Taylor

Add ability to modify a curve's characteristics from Python. Re #2655.

A plotted curves colo(u)r, width and line style can now be changed via the Layer object in Python.

Changeset: 2d84d7687a1fd973e9d537dd5380dd30916f4e7f

comment:5 Changed 9 years ago by Russell Taylor

  • Status changed from new to accepted

comment:6 Changed 9 years ago by Russell Taylor

  • Status changed from accepted to verify
  • Resolution set to fixed

The documentation at http://www.mantidproject.org/MantidPlot:_1D_Plots_in_Python has also been updated.

comment:7 Changed 9 years ago by Peter Parker

  • Status changed from verify to verifying
  • Tester set to Peter Parker

comment:8 Changed 9 years ago by Peter Parker

  • Status changed from verifying to closed

Script ran fine. Tried to break it by generally making a nuisance of myself but couldn't.

comment:9 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3502

Note: See TracTickets for help on using tickets.