implot icon indicating copy to clipboard operation
implot copied to clipboard

Plot layer issue

Open monkeycc opened this issue 1 year ago • 1 comments

DearPyGui

In the plot, I hope the rectangle can be placed at the top

Screenshots/Video:

https://github.com/user-attachments/assets/be7def38-bbd6-44e2-ba12-c12f60089818

Minimal, Complete and Verifiable Example code:

import dearpygui.dearpygui as dpg
import numpy as np
from matplotlib import cm
import time
import cv2


dpg.create_context()

with dpg.window(label="Tutorial", width=400, height=400):
    
    
    values: np.ndarray = np.random.rand(100, 100)
            
    colmap = cm.get_cmap('viridis', 256)
    lut = (colmap.colors[...,0:4]*255).astype(np.uint8)
    rescaled = ((values.astype(float) - values.min())*255/(values.max() - values.min())).astype(np.uint8)
    result = np.ones((*rescaled.shape,4), dtype=np.uint8)
    np.take(lut, rescaled, axis=0, out=result)
    result = result.flatten()/255
    
    with dpg.group(horizontal=True):
        with dpg.texture_registry(show=False):
            dpg.add_raw_texture(width=100, height=100, default_value=np.asarray(result, dtype=np.float32), tag=f"texture_tag", format=dpg.mvFormat_Float_rgba)

        with dpg.plot(label="title", height=-1, width=-1, crosshairs=True, anti_aliased =False, delay_search=True, tag=f"_plot_with"):
            dpg.add_plot_axis(dpg.mvXAxis)


            with dpg.plot_axis(dpg.mvYAxis):
                dpg.add_image_series("texture_tag", [0, 0], [800,800]  )
                
            dpg.add_drag_rect(default_value=(-100, -100, 500, 500),) 



dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

微信截图_20241223235528

monkeycc avatar Dec 25 '24 14:12 monkeycc

I'm really glad you can take on the role of the new maintainer. If you have time, could you help with an adjustment? After the image is loaded, the rectangle cannot be placed on top of the image—it only appears below the image layer. We need to bring the rectangle to the front layer, so it won't be blocked. @brenocq

monkeycc avatar Dec 12 '25 01:12 monkeycc

Hi @monkeycc. I'm not very familiar with dearpygui... Maybe the DearPyGui discussions would be a better place for this question.

I'm happy to help if you can provide a C++ example with this bug

brenocq avatar Dec 21 '25 06:12 brenocq

@V-ein Sorry to bother you, please help me. I don't know how to C++

monkeycc avatar Dec 21 '25 15:12 monkeycc