0
|
10145 Views
|
6 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

# How to shift functions in a multiple-function plot?

Posted 9 years ago
 In the plot shown below (which, as you might guess, is my lame attempt at an energy level diagram) all of the horizontal lines lie along the same column. Is there any way to shift some of these to the right so as to arrange them into a sort of staircase? Plot[{0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}, {x, 1, 1.1}, PlotRange -> {{1, 1.5}, {0, 6}}] Attachments:
6 Replies
Sort By:
Posted 9 years ago
 Here is a way: values = {0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}; Show[Table[ Plot[values[[n]], {x, n - 1, n}, PlotStyle -> Directive[Black, Thickness[.01]]], {n, Length[values]}], PlotRange -> All] You can adjust the thickness to your needs.
Posted 9 years ago
 Ok, I was asked to make them black now haha, sorry about that. Also, if you could tell me how to make the lines a bit thicker, I would appreciate it very much (I used the second method).
Posted 9 years ago
 One way is like this: startingPlot = Plot[{0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}, {x, 1, 2}]; Graphics[GeometricTransformation[First@startingPlot, ShearingTransform[.1Pi, {1, 0}, {0, 1}]], Frame -> True] A different approach, with different domains for the plots: values = {0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}; Show[Table[Plot[values[[n]], {x, n - 1, n}], {n, Length[values]}], PlotRange -> All] Yet another, using ListPlot: values = {0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}; ListPlot[values, PlotMarkers -> "\[LongDash]"] Do you need the lines to be of some particular colors?
Posted 9 years ago
 Thank you! No, the colors don't need to be any color in particular.
Posted 9 years ago
 One way is to apply a ShearingTransform to your plot Graphics[GeometricTransformation[ First@Plot[{0, 1.0812, 2.1096, 2.8883, 3.2302, 4.8815, 5.3394, 5.4031, 5.2447}, {x, 1, 1.1}], ShearingTransform[Pi/3, {1, 0}, {0, 1}]]] 
Posted 9 years ago
 Thank you very much. Is there a way to do it so that the y-axis values are also shown?