When I try to plot some data in Google Colaboratory, it automatically adds some light blueish color and white grids. I want to have a black frame and white background only. Is it possible to do that?
Thanks
I just started using Google Colab this week and also find the plots in colab got a certain style. To make it back to the same default style as jupyter notebook just add this line after you import matplotlib:
plt.style.use('default')
To remove grid, try this:
plt.grid(None)
Typical matplotlib styling options apply in Colab as you'd expect. Here's an example:
https://colab.research.google.com/notebook#fileId=1Gd5qmaw-eqoa2jV0HxEjOssE0PYVpEtH
The key bits are:
plt.rcParams['axes.facecolor'] = 'white'
plt.grid(c='grey')
Related
Issue:
I have a PNG image file that has been exported from a spectrogram (Spectogram 1) I want to change the grey colour background to a white background so it looks crisper.
I have never dealt with images before in R. Is there any way that I could transform the background of Spectrogram 1 to white and convert the wiggly whistle-type contents and axis to a bold black format to look more like a neater version of Spectrogram 2? I tried using software called PhotoScissors here and I nearly created the image that I desire but the x-axis disappears (Spectrogram 3).
If anyone can help, I would be grateful. I've looked online and I cannot find figure it out.
Many thanks in advance.
Spectrogram 1
Spectrogram 2
Spectrogram 3
R might not be the best tool for this task. Though R can interface with the ImageMagick command line tool, which may have functions that will help.
How many images are you converting?
An other tool to consider is GIMP, which has many filters (similar to Photoshop) to consider in your image cleaning.
I applied the following filters to your image as an experiment:
Deinterlace - to remove the vertical bands
Threshold - to convert from grayscale to black and white
I'm using jupyter notebook version 5.2.2 with python
When I display a DataFrame in the notebook the table style looks really nice. Especially the alternating grey and white row colors. When I save the notebook as html the nice style disappears.
Is there any way to keep the style that appears in the notebook itself?
Unfortunately, there is no way to achieve this. I have run into this problem before. When you convert the notebook to HTML you lose that styling.
I am looking to change the background color of a button in my GUI application to default.After searching online, i saw that
button1.SetBackgroundColour(wx.NullColor) does not seem to work. I am using python 2.7.
Is there any other way I could set it to default color with out using system colors
A little late, but maybe someone else has the same problem.
Did you try
button1.SetBackgroundColour(wx.NullColour)
So, write "Colour" instead of "Color", the non-American writing. This worked for me.
If wx.NullColour doesn't work, a solution is to decode the RGB code for the colour you seek and apply it to your background.
E.g. the background color on my wx GUI is the light grey from Windows, its RGB code is R=240, G=240, B=240 (you can measure this using Paint for instance).
Then this should work:
button1.SetBackgroundColour(wx.Colour(240, 240, 240))
Of course if you want your GUI to be portable on other systems this isn't the best option since this light grey is only the default colour in Windows.
With Python 2.7.17 and wxPython 3.0.2.0 the following seems to work:
button1.SetBackgroundColour('')
I think that the solutions do not work because wxPython works with a style system. I was able to change foreground & background colours with the SetStyle method.
I was styling a wx.TextCtrl where I needed to highlight the text I search for.
First, I stored the existing colours to variables.
bc = self.te.GetBackgroundColour()
fc = self.te.GetForegroundColour()
self.bcol = wx.Colour(bc[0], bc[1], bc[2], bc[3])
self.fcol = wx.Colour(fc[0], fc[1], fc[2], fc[3])
Change the colours with SetStyle
self.te.SetStyle(x, y, wx.TextAttr(wx.BLACK, wx.LIGHT_GREY))
And reset it back to the original colours:
self.te.SetStyle(0, -1, wx.TextAttr(self.fcol, self.bcol))
I am using aplypy to create an RGB image of the Eagle nebula from three FITS files, representing the red, green and blue components of the image. The FITS files are available here, 673nm being the red, 656nm the green and 502nm the blue.
import aplpy
aplpy.make_rgb_cube(['673nmos.fits','656nmos.fits','502nmos.fits'], 'nmod_cube.fits')
aplpy.make_rgb_image('nmod_cube.fits','nmod.png')
f = aplpy.FITSFigure('../data/nmod_cube_2d.fits')
f.show_rgb('../data/output/nmod.png')
The image should look something like this, but comes out looking like the image below. The blue component is clearly misaligned with the red and green.
make_rgb_cube is supposed to realign the three images in to the same projection based on the WCS information in each FITS header, according to the docs, but it doesn't seem to be working in this case.
Do I need to employ a star matching library to get the alignment accuracy?
There is an error in the WCS coordinates in the header of the Blue FITS file. I have contacted spacetelescope.org to alert them.
Another example from the site, of M17, is created correctly using the aplpy script shown in the question. Blinking through each filter using DS9, as suggested in the comments, confirms the correct alignment.
Use the STScI software TweakReg to align the images and get a good alignment before combining. More information and worked examples can be found on the DrizzlePac website.
TweakReg:
Combining images using astrodrizzle requires that the WCS information in the headers of each input image align to within sub-pixel accuracy. The tweakreg task allows the user to align sets of images to each other and/or to and external astrometric reference frame or image.
It is optimized for use with HST instruments, but can be adapted for other observatories/instruments.
I am working in a style sheet, I had no major problems with styling until now. I need to remove the three little dots in the middle of the split-pane-divider.
I found no information about those three dots in the JavaFX Reference Guide.
I cant upload a picture to make it clearer, with the resources found on the reference guide I managed to change the background color, borders, and orientation, but the small dots in the enter remain there.
Have a look at the caspian.css file in the jfxrt.jar
Maybe you see there how they styled the split-pane-divider and then you could override it.
Edit:
The OP suggests now the following solution:
.split-pane *.horizontal-grabber {-fx-background-color: transparent, transparent;}
https://stackoverflow.com/review/suggested-edits/2290698