vDataFrame.bubble¶
In [ ]:
vDataFrame.bubble(columns: list,
size_bubble_col: str,
catcol: str = "",
cmap_col: str = "",
max_nb_points: int = 20000,
bbox: list = [],
img: str = "",
ax=None,
**style_kwds,)
Draws a bubble plot of the input vcolumns.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
columns | list | ❌ | List of the vcolumns names. The list must have two elements. |
size_bubble_col | str | ❌ | Numerical vcolumn to use to represent the Bubble size. |
catcol | str | ✓ | Categorical column used as color. |
cmap_col | str | ✓ | Numerical column used with a color map as color. |
max_nb_points | int | ✓ | Maximum number of points to display. |
bbox | list | ✓ | List of 4 elements to delimit the boundaries of the final Plot. It must be similar the following list: [xmin, xmax, ymin, ymax] |
img | str | ✓ | Path to the image to display as background. |
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | any | ✓ | Any optional parameter to pass to the Matplotlib functions. |
In [1]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
titanic.eval(name = "family_size", expr = "parch + sibsp + 1")
display(titanic)
In [2]:
# Regular Bubble Plot
titanic.bubble(["age", "fare"], size_bubble_col = "family_size")
Out[2]:
In [3]:
# Bubble Plot using a categorical column
titanic.bubble(["age", "fare"],
size_bubble_col = "family_size",
catcol = "pclass")
Out[3]:
In [4]:
# Bubble Plot using a categorical column
titanic.bubble(["age", "fare"],
size_bubble_col = "family_size",
cmap_col = "pclass")
Out[4]:
In [5]:
from verticapy import *
from verticapy.datasets import load_world
# Africa Dataset
africa = vDataFrame("africa_education")
africa_world = load_world()
africa_world = africa_world[africa_world["continent"] == "Africa"]
ax = africa_world["geometry"].geo_plot(color = "white",
edgecolor='black',)
# displaying schools in Africa
africa.bubble(["lon", "lat"],
size_bubble_col = "zmalocp",
catcol = "country_long",
ax = ax)
Out[5]:
See Also¶
| vDataFrame.scatter | Draws the Scatter Plot of the input vcolumns. |
