Matplotlib plot zooming with scroll wheel

This should work. It re-centers the graph on the location of the pointer when you scroll. import matplotlib.pyplot as plt def zoom_factory(ax,base_scale = 2.): def zoom_fun(event): # get the current x and y limits cur_xlim = ax.get_xlim() cur_ylim = ax.get_ylim() cur_xrange = (cur_xlim[1] – cur_xlim[0])*.5 cur_yrange = (cur_ylim[1] – cur_ylim[0])*.5 xdata = event.xdata # get … Read more

Given a background color, how to get a foreground color that makes it readable on that background color?

The safest bet is to conform with the World Wide Web Consortium’s (W3C) Web Content Accessibility Guidelines 2.0, which specify a brightness contrast ratio of 4.5:1 for regular text (12 pt or smaller), and 3.0:1 for large text. Contrast ratio is defined as: [Y(b) + 0.05] / [Y(d) + 0.05] Where Y(b) is the brightness … Read more

Adding a GUI to VBScript

VBScript has dialogs, only not many and no checkboxes, you would need a COM object to do so (and there are). I’m sure you know Messagebox and here an example of the less known Popup Dim WshShell, BtnCode Set WshShell = WScript.CreateObject(“WScript.Shell”) BtnCode = WshShell.Popup(“Do you feel alright?”, 7, “Answer This Question:”, 4 + 32) … Read more

Round Specific Corners SwiftUI

Using as a custom modifier You can use it like a normal modifier: .cornerRadius(20, corners: [.topLeft, .bottomRight]) Demo You need to implement a simple extension on View like this: extension View { func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View { clipShape( RoundedCorner(radius: radius, corners: corners) ) } } And here is the struct … Read more