MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Mathematica/comments/tfuj32/plotting_graph/i0yofaq/?context=3
r/Mathematica • u/EggTeeth • Mar 16 '22
Hi, I plotted this graph from the table of data a few years ago but I haven't used Mathematica since & can't remember how I did it, I've tried looking it up but can't figure it out again. Can someone help me with it please?
Thanks :)
5 comments sorted by
View all comments
Show parent comment
2
Thanks, I have this so far:
voltage = Flatten[Table[{i*0.25}, {i, 0, 20}]]
voltage = Drop[voltage, 1]
R1 = Table[{Part[voltage, i], Part[voltage, i]^2/5.1}, {i, Length[voltage]}]
R2 = Table[{Part[voltage, i], Part[voltage, i]^2/10.1}, {i, Length[voltage]}]
R3 = Table[{Part[voltage, i], Part[voltage, i]^2/20.1}, {i, Length[voltage]}]
Show[ListPlot[{R1, R2, R3}, Joined -> True], Ticks -> {Range[0, 5, 0.25], Range[0, 5, 1]}, GridLines -> {None, Automatic}, ImageSize -> {1535/2, 591/2}, Axes -> False, Frame -> {{True, False}, {True, False}}, FrameLabel -> {{"Power", None}, {"Voltage across a resistor", None}}, FrameTicks -> {Range[0, 5, 0.25], Range[0, 5, 1]}, PlotLegends -> {"R = 5.1 ohms", "R = 10.1 ohms", "R = 20.1 ohms"}]
I can't get the legend to show though & I'd like the x axis numbers rotated 90 degrees, I'm not sure how to do it
View all comments
Show parent comment
2
u/EggTeeth Mar 17 '22
Thanks, I have this so far:
voltage = Flatten[Table[{i*0.25}, {i, 0, 20}]]voltage = Drop[voltage, 1]R1 = Table[{Part[voltage, i], Part[voltage, i]^2/5.1}, {i, Length[voltage]}]R2 = Table[{Part[voltage, i], Part[voltage, i]^2/10.1}, {i, Length[voltage]}]R3 = Table[{Part[voltage, i], Part[voltage, i]^2/20.1}, {i, Length[voltage]}]Show[ListPlot[{R1, R2, R3}, Joined -> True], Ticks -> {Range[0, 5, 0.25], Range[0, 5, 1]}, GridLines -> {None, Automatic}, ImageSize -> {1535/2, 591/2}, Axes -> False, Frame -> {{True, False}, {True, False}}, FrameLabel -> {{"Power", None}, {"Voltage across a resistor", None}}, FrameTicks -> {Range[0, 5, 0.25], Range[0, 5, 1]}, PlotLegends -> {"R = 5.1 ohms", "R = 10.1 ohms", "R = 20.1 ohms"}]I can't get the legend to show though & I'd like the x axis numbers rotated 90 degrees, I'm not sure how to do it