I need to plot the voltage in the Y axis and the current in the X axis in ngspice, like X-Y mode in an oscilloscope. I could not find anything regarding this in the manual. Can this be done? If so, how?

found solution:

Fortunatelly ngspice has the 'vs' operator. So if I want to plot let say, voltage at node "in" versus current at resistor R1, I do:

plot v(in) vs @r1[i]

assuming both v(in) and @r1[i] are saved vectors. The operands could also be any voltage or current in the circuit, so you could also plot VxV, IxI, etc.

  • \$\begingroup\$ Typically the X axis of a graph is the thing controlled, and the Y axis the response to it. So if you want to plot voltage in response to current, you need a way to control current. Do you have a current source? If so, do a sweep or analysis relative to it. If it's actually voltage which is controllable, you may need to accept a swapped graph or post process somehow. \$\endgroup\$ – Chris Stratton Oct 7 '20 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.