File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,17 @@ def draw_line2d(data, obj):
128
128
# xdata, ydata = _transform_to_data_coordinates(obj, *obj.get_data())
129
129
xdata , ydata = obj .get_data ()
130
130
131
+ # matplotlib allows plotting of data containing `astropy.units`, but they will
132
+ # break the formatted string here. Try to strip the units from the data.
133
+ try :
134
+ xdata = xdata .value
135
+ except AttributeError :
136
+ pass
137
+ try :
138
+ ydata = ydata .value
139
+ except AttributeError :
140
+ pass
141
+
131
142
try :
132
143
has_mask = ydata .mask .any ()
133
144
except AttributeError :
@@ -144,16 +155,6 @@ def draw_line2d(data, obj):
144
155
else :
145
156
content .append ('%.15g %.15g\n ' % (x , y ))
146
157
else :
147
- # matplotlib allows plotting of data containing `astropy.units`, but they will
148
- # break the formatted string here. Try to strip the units from the data.
149
- try :
150
- xdata = xdata .value
151
- except AttributeError :
152
- pass
153
- try :
154
- ydata = ydata .value
155
- except AttributeError :
156
- pass
157
158
for (x , y ) in zip (xdata , ydata ):
158
159
content .append ('%.15g %.15g\n ' % (x , y ))
159
160
content .append ('};\n ' )
You can’t perform that action at this time.
0 commit comments