Posts

Showing posts from June, 2021

Tips To Overcome Over plotting of Dense Scatter Plots.

Image
Here are some tricks to overcome overplotting of dense scatter plots Use a transparency factor: # Matplotlib scatter plot with an alpha value plt . scatter ( df [ X_COL ], df [ Y_COL ], alpha = 0.03 ) plt . xlabel ( X_COL ) plt . ylabel ( Y_COL ) plt . show () This will introduce some transparency to your visual and the less transparency the denser. You can make this even cooler with animated transparency: # Initialize plot and animation camera fig , ( ax1 , ax2 ) = plt . subplots ( 1 , 2 ) # Create 2 camera = Camera ( fig ) # Create a sequence of alpha values alpha_range = np . linspace ( 0.5 , 0 , 30 ) ** 3 # For each alpha value for alpha_value in alpha_range : # Plot "vanilia" plot for reference ax1 . scatter ( df [ X_COL ], df [ Y_COL ], color = 'black' ) # Plot scatter plot with the alpha value ax2 . scatter ( df [ X_COL ], df [ Y_COL ], alpha = alpha_value , color = 'black' ) # Take a &qu

Filter a Column With Values of Another Column Using DAX Instead of Many to Many Relationship

Image
So you want to filter a column in table A with values in a column in table B, but both contain duplicated data, the many to many can resolve this but I don't think this is your best approach so let's discuss how you can get around this. why you may not want to use Power BI Many to Many even though you think you do: Well, according to Power BI itself the many to many relationships create some ambiguity in your data and to your end-user as he/she won't know which column should he use to filter the data,  also according to Patrick from guy in a cube , it's not your best approach. so here I'm going to introduce two approaches to solve this one that Patrick has already introduced  and that one I've found using DAX and it is mind-blowing!  First, let's look at the kind of ambiguity I'm talking about: Here I've created some dummy data where table A and B contains city column A with the sales of each city Both columns contain the city name more than one so i