Dataverse
Dataverse copied to clipboard
Support plotting 3D Scatter Plot in software.
The software currently displays only the button for 3D Scatter plot, the code is yet to be written and linked.
[!IMPORTANT] Keep the GUI same as other plots and use the predefined color map.
Assign this to me @multiverseweb
@Anushka184 assigned, good luck!
Hey I was wondering if two people can work on same issue? if so, please assign it to me
@nithinrvs Yes, more than one people can work on the same issue, but that reduces the chances of getting your pull request merged. As then the project admin will have multiple solutions to one issue. It can be acceptable for lower level issues but not for time-consuming issues like this one.
You can check other issues though, appreciate your willingness to contribute.
import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np
Function to plot 3D Scatter
def plot_3d_scatter(): # Sample Data x = np.random.rand(100) y = np.random.rand(100) z = np.random.rand(100) colors = z # Color map based on z values
# Clear any previous plot
ax.clear()
# 3D Scatter Plot
scatter = ax.scatter(x, y, z, c=colors, cmap='viridis') # Using predefined 'viridis' colormap
# Add color bar
fig.colorbar(scatter, ax=ax, shrink=0.5, aspect=5)
# Redraw the canvas
canvas.draw()
Setup Tkinter window
root = tk.Tk() root.title("3D Scatter Plot Viewer")
Create a figure and axis
fig = plt.figure() ax = fig.add_subplot(111, projection='3d')
Embed the Matplotlib figure into the Tkinter canvas
canvas = FigureCanvasTkAgg(fig, master=root) canvas.get_tk_widget().pack()
Button to display the 3D scatter plot
scatter_button = tk.Button(root, text="3D Scatter Plot", command=plot_3d_scatter) scatter_button.pack()
Run the Tkinter main loop
root.mainloop()
you can change the colormap if needed but here it is virdis thats used
Hey @Anushka184, Here you have randomized the data points. Is it possible that you take the data as input from user through the GUI? just like all other types of graphs in the software.
@multiverseweb can I work on this issue looks very much similar to issue #3
Sure @Rohan20-10, good luck!
Sure @Rohan20-10, good luck!
Thanks @multiverseweb
@multiverseweb the x would be string input and the z will be int input then the y input should be either string/int/both. Please clarify this.
@Rohan20-10 I couldn't understand why x would be string? In my opinion, the input names for x, y and z axes should be string but the values of these variables should be int.
@Rohan20-10 I couldn't understand why x would be string? In my opinion, the input names for x, y and z axes should be string but the values of these variables should be int.
@multiverseweb Yeah that's what I wanted to ask. Now it is clear, thanks for your suggestion. Got your point.