Dataverse icon indicating copy to clipboard operation
Dataverse copied to clipboard

Support plotting 3D Scatter Plot in software.

Open multiverseweb opened this issue 1 year ago • 12 comments

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.

image

multiverseweb avatar Oct 01 '24 15:10 multiverseweb

Assign this to me @multiverseweb

Anushka184 avatar Oct 01 '24 16:10 Anushka184

@Anushka184 assigned, good luck!

multiverseweb avatar Oct 01 '24 16:10 multiverseweb

Hey I was wondering if two people can work on same issue? if so, please assign it to me

nithinrvs avatar Oct 01 '24 16:10 nithinrvs

@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.

multiverseweb avatar Oct 01 '24 19:10 multiverseweb

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

Anushka184 avatar Oct 02 '24 09:10 Anushka184

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 avatar Oct 02 '24 18:10 multiverseweb

@multiverseweb can I work on this issue looks very much similar to issue #3

Rohan20-10 avatar Oct 04 '24 17:10 Rohan20-10

Sure @Rohan20-10, good luck!

multiverseweb avatar Oct 04 '24 17:10 multiverseweb

Sure @Rohan20-10, good luck!

Thanks @multiverseweb

Rohan20-10 avatar Oct 05 '24 03:10 Rohan20-10

@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 avatar Oct 05 '24 04:10 Rohan20-10

@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 avatar Oct 05 '24 04:10 multiverseweb

@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.

Rohan20-10 avatar Oct 05 '24 04:10 Rohan20-10