Make charts on a text console using character graphics
Generate graphical output on a text console. These routines predate modern GUI environments. While the output may look rough, they work just about anywhere.
Here is how the code may be called:
>>> fn = toolbox.GetTest1DataFilename('.smr')
>>> x, y, dy = toolbox.GetDat(fn)
>>> print("Data plot: " + fn)
>>> Screen().xyplot(x, y)
Example, given C(q) and S(q):
KratkyPlot = textplots.Screen()
title = "\nKratky plot, I * q^2 vs q: S=smeared"
q2C = q*q*(C - B)
q2S = q*q*(S - B)
KratkyPlot.SetTitle(title)
KratkyPlot.addtrace(lnq, q2S, "S")
KratkyPlot.printplot()
title = "\nKratky plot, I * q^2 vs q: C=input, S=smeared"
KratkyPlot.SetTitle(title)
KratkyPlot.addtrace(lnq, q2C, "C")
KratkyPlot.printplot()
with the right data, produces plots of and :
Kratky plot, I * q^2 vs q: C=input, S=smeared
x: min=-7.898 step=0.0889226 max=-1.49558
y: min=-0.107876 step=0.199276 max=4.2762
-------------------------------------------------------------------------
| C |
| CCCCCC |
| CCC CCC |
| CC CC |
| CC CC |
| CC C |
| C C |
| C C |
| CC CC |
|CC C |
| C |
|C CC |
| C |
| C |
| C |
| C |
| CC |
| C |
| CC |
| CC |
| CCC |
| CCCCCC CCCC |
|SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC|
-------------------------------------------------------------------------
plotting canvas
add the (x,y) trace to the plot with the given symbol
Parameters: |
|
---|
plot the traces on the screen buffer data scaling functions are offset by +1 for plot frame