@app.route("/plot.png")
or @app.route("/plot.svg")
. (SVG is Scalable Vector Graphics and vector graphics is represented by a list of geometric shapes such as points, lines, curves, Link, PNG is Portable Network Graphics and raster graphics is represented by a matrix of pixel color values, Link) flask.Response(image, headers={"Content-Type": "image/png"})
or flask.Response(image, headers={"Content-Type": "image/svg+xml"})
, where the image is a bytes
object and can be obtained using io.BytesIO.getvalue()
where io.BytesIO
creates a "fake" file to store the image. <img src="plot.png">
or <img src="plot.svg">
. Encoding | Continuous | Ordinal | Discrete (Categorical) |
Position | Yes | Yes | Yes |
Size | Yes | Yes | No |
Shape | No | No | Yes |
Value | Yes | Yes | No |
Color | No | No | Yes |
Orientation | Yes | Yes | Yes |
Texture | No | No | Yes |
seaborn
is one of the data visualization libraries that can make plots for exploring the datasets with a few dimensions (features): Link c1
, c2
, ..., then seaborn.relplot(data = ..., x = "c1", y = "c2", hue = "c3", size = "c4", style = "c5")
visualizes the relationship between the columns by encoding c1
by x-position, c2
by y-position, c3
by color hue if the feature is discrete, and by color value if it is continuous, c4
by size, c5
by shape (for example, o's and x's for points, solid and dotted for lines) if the feature is discrete. seaborn.relplot(data = ..., ..., col = "c6", row = "c7")
produces multiple columns of plots one for each category of c6
, and multiple rows of plots one for each category of c7
. seaborn.pairplot
produces a scatter plot for each pair of columns (features) which could be useful for exploring relationships between pairs of continuous features too. matplotlib
. Last Updated: November 18, 2024 at 11:43 PM