4.6.2 Converting between different temperature scalesPyxplot can convert temperatures between different temperature scales, for example between Consider the following two questions:
The answers to these two questions are 293 K and 20 K respectively: although we are converting from The cause of this problem, and the reason why it rarely affects any physical units other than temperatures is that there exists such a thing as absolute temperature. Take the example of distances. Distances are almost always relative: they measure distance gaps between points. Occasionally people might choose to express positions as distance from some particular origin. But if scheme A involved measuring in meters from New York, and scheme B involved measuring in feet from Chicago, they wouldn’t expect Pyxplot to convert between the two systems. The problem of converting between temperature systems is just like this. One system measures distance in degrees Fahrenheit away from 0 As Pyxplot cannot distinguish between absolute and relative temperatures, it takes a safe approach of performing algebra consistently with any unit of temperature, never performing automatic conversions between different temperature scales. A calculation based on temperatures measured in
Note that the two units of temperature must be placed in separate unit(...) functions. The following is not allowed:
Note that such a conversion always assumes that the temperatures supplied are absolute temperatures. Pyxplot has no facility for converting relative temperatures between different scales. This must be done manually. The conversion of derived units of temperature, such as The moral of this story is: pick what unit of temperature you want to work in, convert all of your temperatures to that scale, and then stick to it. Example: Creating a simple temperature conversion scale In this example, we use Pyxplot’s automatic conversion of physical units to create a temperature conversion scale. set size ratio 1e-2 set axis x2 linked x using x*unit(oC)/unit(oF) set axis y invisible set xtics outward -10,10 set x2tics outward 20,20 set xlabel r"$ ![]() ![]() set x2label r"$ ![]() ![]() plot [-10:100] ![]() Footnotes
|