(self, strike_column, dip_column, color_column=None)
| 2924 | self.hole_ids = hole_ids |
| 2925 | |
| 2926 | def plot(self, strike_column, dip_column, color_column=None): |
| 2927 | # Filter DataFrame based on selected hole IDs |
| 2928 | df = self.df[self.df['hole_id'].isin(self.hole_ids)] |
| 2929 | |
| 2930 | # Convert strike angles to radians |
| 2931 | strike_angles = np.radians(df[strike_column]) |
| 2932 | |
| 2933 | # Determine colors for each row in DataFrame |
| 2934 | if color_column: |
| 2935 | unique_values = df[color_column].unique() |
| 2936 | colormap = plt.cm.get_cmap('viridis', len(unique_values)) |
| 2937 | color_dict = dict(zip(unique_values, [colormap(i) for i in range(len(unique_values))])) |
| 2938 | colors = df[color_column].map(color_dict) |
| 2939 | else: |
| 2940 | colors = 'blue' |
| 2941 | |
| 2942 | # Create rose diagram |
| 2943 | plt.figure(figsize=(8, 8)) |
| 2944 | ax = plt.subplot(111, projection='polar') |
| 2945 | |
| 2946 | # Bin strike angles and get the counts for each bin |
| 2947 | strike_bins = np.linspace(0, 2*np.pi, 36) |
| 2948 | counts, bin_edges = np.histogram(strike_angles, bins=strike_bins) |
| 2949 | |
| 2950 | # Compute bin centers |
| 2951 | bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2.0 |
| 2952 | |
| 2953 | ax.bar(bin_centers, counts, color=colors, width=2*np.pi/36) |
| 2954 | |
| 2955 | ax.set_theta_zero_location('N') |
| 2956 | ax.set_theta_direction(-1) |
| 2957 | |
| 2958 | # If there is color coding, add a legend |
| 2959 | if color_column: |
| 2960 | legend_handles = [] |
| 2961 | for category, color in color_dict.items(): |
| 2962 | legend_handles.append(mpatches.Patch(color=color, label=category)) |
| 2963 | ax.legend(handles=legend_handles, loc='upper left') |
| 2964 | |
| 2965 | plt.show() |
| 2966 | |
| 2967 | |
| 2968 | def dialog(self): |
no outgoing calls
no test coverage detected