@@ -115,7 +115,7 @@ def draw_pathcollection(data, obj):
115
115
content = []
116
116
# gather data
117
117
assert obj .get_offsets () is not None
118
- labels = ["x" + 3 * " " , "y" + 3 * " " ]
118
+ labels = ["x" , "y" ]
119
119
dd = obj .get_offsets ()
120
120
121
121
fmt = "{:" + data ["float format" ] + "}"
@@ -126,14 +126,19 @@ def draw_pathcollection(data, obj):
126
126
127
127
if obj .get_array () is not None :
128
128
draw_options .append ("scatter" )
129
- dd = np .column_stack ([dd , obj .get_array ()])
130
- labels .append ("colordata" + 13 * " " )
129
+ dd_strings = np .column_stack ([dd_strings , obj .get_array ()])
130
+ labels .append ("colordata" )
131
131
draw_options .append ("scatter src=explicit" )
132
132
table_options .extend (["x=x" , "y=y" , "meta=colordata" ])
133
133
ec = None
134
134
fc = None
135
135
ls = None
136
136
marker0 = None
137
+ if obj .get_cmap ():
138
+ mycolormap , is_custom_cmap = _mpl_cmap2pgf_cmap (obj .get_cmap (), data )
139
+ draw_options .append (
140
+ "colormap" + ("=" if is_custom_cmap else "/" ) + mycolormap
141
+ )
137
142
else :
138
143
# gather the draw options
139
144
add_individual_color_code = False
@@ -150,7 +155,7 @@ def draw_pathcollection(data, obj):
150
155
else :
151
156
print (ec )
152
157
assert len (ec ) == len (dd )
153
- labels .append ("draw" + 3 * " " )
158
+ labels .append ("draw" )
154
159
ec_strings = [
155
160
"," .join (fmt .format (item ) for item in row )
156
161
for row in ec [:, :3 ] * 255
@@ -170,7 +175,7 @@ def draw_pathcollection(data, obj):
170
175
fc = fc [0 ]
171
176
else :
172
177
assert len (fc ) == len (dd )
173
- labels .append ("fill" + 3 * " " )
178
+ labels .append ("fill" )
174
179
fc_strings = [
175
180
"," .join (fmt .format (item ) for item in row )
176
181
for row in fc [:, :3 ] * 255
@@ -235,10 +240,6 @@ def draw_pathcollection(data, obj):
235
240
data , extra_draw_options = get_draw_options (data , obj , ec , fc , ls , None )
236
241
draw_options += extra_draw_options
237
242
238
- if obj .get_cmap ():
239
- mycolormap , is_custom_cmap = _mpl_cmap2pgf_cmap (obj .get_cmap (), data )
240
- draw_options .append ("colormap" + ("=" if is_custom_cmap else "/" ) + mycolormap )
241
-
242
243
legend_text = get_legend_text (obj )
243
244
if legend_text is None and has_legend (obj .axes ):
244
245
draw_options .append ("forget plot" )
@@ -252,8 +253,8 @@ def draw_pathcollection(data, obj):
252
253
# See Pgfplots manual, chapter 4.25.
253
254
# In Pgfplots, \mark size specifies radii, in matplotlib circle areas.
254
255
radii = np .sqrt (obj .get_sizes () / np .pi )
255
- dd = np .column_stack ([dd , radii ])
256
- labels .append ("sizedata" + 14 * " " )
256
+ dd_strings = np .column_stack ([dd_strings , radii ])
257
+ labels .append ("sizedata" )
257
258
draw_options .extend (
258
259
[
259
260
"visualization depends on="
@@ -274,7 +275,7 @@ def draw_pathcollection(data, obj):
274
275
to = " [{}]" .format (", " .join (table_options )) if table_options else ""
275
276
content .append (f"table{ to } {{%\n " )
276
277
277
- content .append (( " " .join (labels )). strip ( ) + "\n " )
278
+ content .append (" " .join (labels ) + "\n " )
278
279
ff = data ["float format" ]
279
280
280
281
for row in dd_strings :
0 commit comments