@@ -92,25 +92,22 @@ def __call__(self, x):
92
92
counts += counts .min ()
93
93
94
94
fig = plt .figure ()
95
- fig .subplots_adjust (hspace = 0.3 )
96
-
97
- ax1 = fig .add_subplot (211 )
98
- ax2 = fig .add_subplot (212 , sharex = ax1 , sharey = ax1 )
95
+ ax1 = fig .add_subplot (111 )
96
+ ax2 = fig .add_subplot (111 , sharex = ax1 , sharey = ax1 , frameon = False )
99
97
100
98
ax1 .plot (temp_C , counts , drawstyle = 'steps-mid' )
101
- ax2 .plot (temp_C , counts , drawstyle = 'steps-mid' )
102
99
103
100
ax1 .xaxis .set_major_formatter (StrMethodFormatter ('{x:0.2f}' ))
104
101
105
102
# This step is necessary to allow the shared x-axes to have different
106
103
# Formatter and Locator objects.
107
104
ax2 .xaxis .major = Ticker ()
108
105
# 0C -> 491.67R (definition), -273.15C (0K)->0R (-491.67F)(definition)
106
+ ax2 .xaxis .set_major_locator (ax1 .xaxis .get_major_locator ())
109
107
ax2 .xaxis .set_major_formatter (
110
108
TransformFormatter (LinearTransform (in_start = - 273.15 , in_end = 0 ,
111
109
out_end = 491.67 ),
112
110
StrMethodFormatter ('{x:0.2f}' )))
113
- ax2 .xaxis .set_major_locator (ax1 .xaxis .get_major_locator ())
114
111
115
112
# The y-axes share their locators and formatters, so only one needs to
116
113
# be set
@@ -120,11 +117,12 @@ def __call__(self, x):
120
117
ax1 .yaxis .set_major_formatter (
121
118
TransformFormatter (int , StrMethodFormatter ('{x:02X}' )))
122
119
123
- fig .suptitle ('Temperature vs Counts' )
124
- ax1 .set_xlabel ('Temp (\u00B0 C)' )
120
+ ax1 .set_xlabel ('Temperature (\u00B0 C)' )
125
121
ax1 .set_ylabel ('Samples (Hex)' )
126
- ax2 .set_xlabel ('Temp (\u00B0 R)' )
127
- ax2 .set_ylabel ('Samples (Hex)' )
122
+ ax2 .set_xlabel ('Temperature (\u00B0 R)' )
123
+
124
+ ax1 .xaxis .tick_top ()
125
+ ax1 .xaxis .set_label_position ('top' )
128
126
129
127
plt .show ()
130
128
0 commit comments