Skip to content

Commit

Permalink
scatterplot bug (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorisjlee committed Apr 10, 2021
1 parent 4a04723 commit 064ca68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lux/vislib/matplotlib/ScatterChart.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def initialize_chart(self):
vals = [unique.index(i) for i in colors]
if color_attr_type == "quantitative":
self.fig, self.ax = matplotlib_setup(7, 5)
set_fig_code = "fig, ax = plt.subplots(7, 5)\n"
set_fig_code = "fig, ax = plt.subplots(figsize=(7, 5))\n"
self.ax.scatter(x_pts, y_pts, c=vals, cmap="Blues", alpha=0.5)
plot_code += f"ax.scatter(x_pts, y_pts, c={vals}, cmap='Blues', alpha=0.5)\n"
my_cmap = plt.cm.get_cmap("Blues")
Expand Down Expand Up @@ -96,10 +96,10 @@ def initialize_chart(self):
maxlen = len(unique[i])
if maxlen > 20:
self.fig, self.ax = matplotlib_setup(9, 5)
set_fig_code = "fig, ax = plt.subplots(9, 5)\n"
set_fig_code = "fig, ax = plt.subplots(figsize=(9, 5))\n"
else:
self.fig, self.ax = matplotlib_setup(7, 5)
set_fig_code = "fig, ax = plt.subplots(7, 5)\n"
set_fig_code = "fig, ax = plt.subplots(figsize=(7, 5))\n"

cmap = "Set1"
if len(unique) > 9:
Expand Down Expand Up @@ -131,7 +131,7 @@ def initialize_chart(self):
fontsize='13')\n"""
plot_code += "scatter.set_alpha(0.5)\n"
else:
set_fig_code = "fig, ax = plt.subplots(4.5, 4)\n"
set_fig_code = "fig, ax = plt.subplots(figsize=(4.5, 4))\n"
self.ax.scatter(x_pts, y_pts, alpha=0.5)
plot_code += f"ax.scatter(x_pts, y_pts, alpha=0.5)\n"
self.ax.set_xlabel(x_attr_abv, fontsize="15")
Expand Down

0 comments on commit 064ca68

Please sign in to comment.