When I use highchart in both Chrome and Firefox, the font size appears quite bigger in Firefox. Below is one example -
In Chrome -
In Firefox -
How can I make font size appears exactly same in two browser?
Any pointer will be appreciated.
Adding one more example -
R code -
Data = data.frame(x = round(rnorm(20) * 100, 2), y = round(rnorm(20) * 100, 2), z = letters[1:20])
hchart(Data, "scatter", hcaes(x, y)) %>%
hc_yAxis(
plotLines = list(
list(color = "#252525",
width = 2,
value = 0)
)
)
Plot on Firefox -
Plot on Chrome -
I am using MacOS as operating system
Related
I am rasterizing my Shapefiles for creating labels for Semantic Segmentation using U-Net using the following code:
rstzr = r.Rasterizer(shape_file,
raster_file,
class_column,
classes_interest = classes_of_interest,
non_class_name = non_class)
rstzr.collect_class_names()
rstzr.rasterize_layer()
rstzr.remove_labels_under_cloud(pos_qa = 0, new_label = 3)
m_class_names = ['No Data'] + rstzr.get_class_names() + ['Clouds']
rasterized_layer = rstzr.get_labeled_raster()
rstzr.save_labeled_raster_to_gtiff(out_labels)
vis.plot_labels(rasterized_layer, m_class_names, colors = ['white', 'green', 'yellow', 'blue'], title = "Rasterized Ground Truth")
When I am using this code in Google Colab Rasterized Shapefiles, it is working properly and the Rasterized Ground Truth is also being plotted as can be seen in the screenshot. But when I am trying the same code in other Jupyter Platform of my university with high computation performance, it is showing error which can be seen in the screenshot
Can anyone suggest what can be the issue for the error
ValueError: There are 5 color bins including extensions, but ncolors = 4; ncolors must equal or exceed the number of bins
while it is working properly when I use it with Google Colab?
I'm new to flash and I'm trying to create a board game with actionscript 3.0
I have already created the background (checker squares) for the board and now I have to partition the background by each box. What are the ways I can achieve that? I want to logically put numbers for each square as seen in the picture.
I realized its possible to do it using lasso tool and convert each to symbols. But is there any "lazy" way of doing that? There are lots of cuts I'd have to make in order to do that.
We can use some simple calculations to map some (x, y) value to a number. Lets say:
widht = width of the image
height = height of the image
gridCount = 8
gridWidth = width / gridCount
gridHeight = height / gridCount
Now first we would like to map user click point (x, y) to some integer index i, j to the logical 8 x 8 matrix where top left is index 0, 0.
i = x / gridWidth
j = y / gridHeight
For example, if gridWidth = 60, gridHeight = 50 and user clicks on (10, 15) then i = 0, j = 0.
Now we have to map this i, j to the specified numbers. As bottom line contains 11, 21, 31, ... and every column is increasing, the final number will be:
num = (11 + i * 10) + (gridCount - j - 1)
Converting these equations to AS3 code is straight forward, so I'm not adding them.
In Poppler, PDF files are rendered as images,
I'm trying to determine the suitable zoom ratio to be able to render an image that can fit the full screen.
I have all parameter but I don't know why the result is always wrong.
myDPIx = 96
screenX = 1366px
screenY = 768px
imageX = 720px
imageY = 720px
zoomX = screenX/imageX
zoomY = screenY/imageY
newDPIx = myDPIx * zoomX
newDPIy = myDPIy * zoomY
let's assume that we have a render() function, it will be called as follow :
new_image = render(image, newDPIx, newDPIy)
Unfourtunately, the rendered image is too big, which means that my calculations are wrong ?
newImageX = 1840
newImageY = 1045
which is about 2.5 times bigger !
PS: if I set a zoom as 1.4 I get a suitable zoom, but I try to make this generic for all screen resolutions.
Am I missing something ?
I have pygame based video player, it has berkelium browser used for GUI,
under that are VLC libraries for playing streams. I did not make the player, but I would
like to add a "resize" option, which is not currently present.
The application is made for OS X.
On initialization of the player, pygame.set_mode(screensize,OPENGL|DOUBLEBUF|RESIZABLE) is called, problem is when I resize the window more than the screen size, these parts are not visible(shown bugged), if I try pygame.set_mode again, it causes the app to crash because of dependencies (browser and VLC).
So I decided to initialize screen using:
pygame.set_mode(screenresolution, OPENGL|DOUBLEBUF|RESIZABLE)
Which should set it to the max and then switch back to original, smaller resolution (like resize with the mouse).
How to do that? how to simulate the RESIZABLE flag and mouse move action?
The player works nice resizing to smaller sizes, it is only bigger sizes that are a problem.
class InputAndDisplay:
def init(self, fullscreen=False):
global pygame, sys
# if 'darwin' in sys.platform:
# import sys
# sys.argv = ['Core.py']
# import pygame.macosx
# pygame.macosx.init()
pygame.init()
global screenSize
self.screenSize = screenSize
if fullscreen:
try: self.screenSize = pygame.display.list_modes()[0]
except Exception, e: print e
flags = OPENGL|DOUBLEBUF|FULLSCREEN
else:
flags = RESIZABLE|OPENGL|DOUBLEBUF
print 'screenSize:', self.screenSize
try:
povrsina = pygame.display.set_mode(self.screenSize, flags)
except Exception, e:
print e
self.screenSize = screenSize
povrsina = pygame.display.set_mode(self.screenSize, RESIZABLE|OPENGL|DOUBLEBUF)
pygame.display.set_caption('NetTVBox-WebPlayer')
pygame.mouse.set_pos(list(self.screenSize))
if 'darwin' not in sys.platform:
pygame.mouse.set_visible(False)
#pygame.key.set_repeat(300, 100)
if 'darwin' not in sys.platform:
pygame.mixer.quit()
if 'linux' in sys.platform: # try to turn off vsyncing
import ctypes
libgl = ctypes.cdll.LoadLibrary('libGL.so.1')
proc = libgl.glXGetProcAddressARB('glXSwapIntervalMESA')
_glXSwapIntervalMESA = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int)(proc)
_glXSwapIntervalMESA(0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
#gluPerspective(45.0, 640/480.0, 0.1, 100.0)
glOrtho(-0.5, 0.5, -0.5, 0.5, -5, 5)
#glTranslatef(0.0, 0.0, -3.0)
#glRotatef(25, 1, 0, 0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glEnable(GL_TEXTURE_2D)
glShadeModel(GL_FLAT)
glClearColor(0.0, 0.0, 0.0, 0.0)
glClearDepth(1.0)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
self.textures = glGenTextures(2)
self.threeDmode = MODE_3D_OFF
that's init in inputAndDisplay.py
And main file is Core.py which calls it, and a lot of other stuff as well. Thats why I didnt put all the code here, there is a lot of it and not all important
Here is part of Core.py:
input_and_display = InputAndDisplay()
input_and_display.init(self.fullscreen)
rc = RemoteControl()
rc.init()
media = Media()
if 1: # !
media.config = {
'buffering': state.mediaplayer_buffering,
'contrast': state.mediaplayer_contrast,
'saturation': state.mediaplayer_saturation,
}
media.init()
browser = Browser()
browser.init()
Thanks in advance for the help
It sounds like you're missing the VIDEORESIZE event to detect resizing.
( See related events : VIDEOEXPOSE, ACTIVEEVENT http://www.pygame.org/docs/ref/event.html )
http://www.pygame.org/docs/ref/display.html#pygame.display.set_mode
" Then the display mode is set, several events are placed on the pygame event queue. pygame.QUIT is sent when the user has requested the program to shutdown. The window will receive pygame.ACTIVEEVENT events as the display gains and loses input focus. If the display is set with the pygame.RESIZABLE flag, pygame.VIDEORESIZE events will be sent when the user adjusts the window dimensions. Hardware displays that draw direct to the screen will get pygame.VIDEOEXPOSE events when portions of the window must be redrawn. "
Is there any way to convert the image so it appears as a gray scale. Changing rgb is not working as required.
As you probably know, screen color consists of 3 components: red, green and blue. Each component or color (for example, red) has a value from 0 to 255. The value 0 indicates there is no red color and the value 255 would be the brightest possible red color. To convert a color to grayscale you just need to calculate the average for all three components. This can be done using the simple formula below:
grayscalecolor = (red + green + blue) / 3;
Canvas Method
var canvas = document.createElement('canvas');
var canvasContext = canvas.getContext('2d');
var imgW = imgObj.width;
var imgH = imgObj.height;
canvas.width = imgW;
canvas.height = imgH;
canvasContext.drawImage(imgObj, 0, 0);
var imgPixels = canvasContext.getImageData(0, 0, imgW, imgH);
for(>var y = 0; y < imgPixels.height; y++){
for(>var x = 0; x < imgPixels.width; x++){
var i = (y * 4) * imgPixels.width + x * 4;
var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
imgPixels.data[i] = avg;
imgPixels.data[i + 1] = avg;
imgPixels.data[i + 2] = avg;
}
}
canvasContext.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
return canvas.toDataURL();
Microsoft Internet Explorer does not support the CANVAS tag, but Microsoft does provide image manipulation through filters. The filter to use for converting images to grayscale is the filter named DXImageTransform.Microsoft.BasicImage.
imgObj.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)';
If you're able to use HTML5 you could use a canvas, as seen here.
Google for "canvas grayscale image" the first link will be:
HTML 5 introduces Canvas object which can be used to draw and manipulate images. In this example, I used a Canvas to turn an image into grayscale. If your browser supports Canvas, you should see two images above: the normal image and the grayscale one. The grayscale one is not a separate image, it is generated by utilizing Canvas.
http://permadi.com/tutorial/jsCanvasGrayscale/index.html
If you want this to be done client side (on the browser) with a HTML you will need to use a Canvas. Example here: http://www.youtube.com/watch?v=QJa7tWScXS4
Use PaintbrushJS:
http://mezzoblue.github.com/PaintbrushJS/demo/
It lets you apply any number of filters including greyscale and works in most modern browsers. It's not a 'HTML' solution, that would not be possible without two images.
At least it works on most browsers, including ones which don't yet support HTML5.