scale

Create ggplots with the same scale in R

Deadly 提交于 2019-12-08 07:14:28
问题 I'd like to do the following in R: I have 2 datasets (one consisting of 4, the other of 3 values) and I'd like to plot them with ggplot2 as bar charts (separately). However, I'd like to use the same scale for the both, i.e.: if the minimum value of dataset #1 is 0.2 and 0.4 of dataset #2, then I want to use 0.2 for both. Same applies for the maximum values (choosing the greater there). So, basically, I want to make the 2 plots comparable. Of course, would be great to apply the common scale

D3 Brush coordinates under CSS transform scale

无人久伴 提交于 2019-12-08 07:00:50
问题 D3 brush does not function properly under css transform scale. When svg is under div element, and div element is transformed using CSS scale, the brush operation shows wrong coordinates. To demonstrate this case, here is the jsFiddle. It is simple modification from Bostock's Brushable Network example. What I did was simply putting SVG in the div element and made div element zoom 50% using CSS transform scale(0.5). And the brushing coordinates are not updating because of zooming. #test {

How to communicate with scale via rs232

 ̄綄美尐妖づ 提交于 2019-12-08 04:00:36
问题 I am trying to make my C# application communicate with digital scale via rs232 by using SerialPort class in .net. Unfortunatelly I can't get any feedback from the scale. It's a TSCALE TSQSP scale and aparently it's using CAS communication protocol. From my understanding in CAS protocol i need to send "ENQ" wait for "ACK" and then send "DC1" to get information, but after sending "ENQ" I am not getting any reply. Here is my code. Does anybody has experience with scale with same communication

Android scale view

泄露秘密 提交于 2019-12-08 03:25:57
问题 I need to scale View by setting the scale factor in percents. I need to set exactly the same param as ScaleAnimation use, because I'm going to scale it using ScaleAnimation in the future. How do I do it? Thanks 回答1: I've solved the problem by creating animation xml file with duration=0, which sets desired parameters. It is also possible to create such animation via code. Then to apply it, just use: Animation animationInit = AnimationUtils.loadAnimation(context, R.anim.gallery_init); v

CSS transform scale to background image

孤街醉人 提交于 2019-12-08 02:09:29
问题 I have beloved CSS part effecting for a image .split-banner .right-cl:hover img { -webkit-transform: scale(1.1); transform: scale(1.1); } I need to apply above CSS to background image contain in a div element How can I do that? 回答1: Change background-size on hover. To mimic scale(1.1) use 110% . div { width: 560px; height: 400px; background: url('http://kenwheeler.github.io/slick/img/fonz1.png') center center no-repeat; } div:hover { background-size: 110%; } <div></div> 来源: https:/

Javascript Image Resize Calculation

穿精又带淫゛_ 提交于 2019-12-07 23:37:06
问题 Let's say I have an image that is 1920 x 1280. I'm using a slider to scale down the image, which goes from 100% to 0%, where 100% is the original size and 0% is the minimum size. The image can be no smaller than 350 in either height, or width, so 0% should equate to this minimum size. What formula would I use to calculate the new dimensions? If you could explain the logic, that would be helpful. I'm certain this is an SAT question that I failed... 回答1: var min=Math.min(width,height); var

Calculate the width and height of parent div and apply to image accordingly

微笑、不失礼 提交于 2019-12-07 19:57:13
问题 I have a parent div which in responsive width and fixed height with some images inside it. On runtime I need a Jquery function to calculate the width and height of the div and apply the width (px) and height (px) parameters to image. i.e my code right now is <div id="slider-wrapper" class="someclass"> <img src="/image1.jpg" alt="" /> <img src="/image2.jpg" alt="" /> <img src="/image3.jpg" alt="" /> </div> the generated code which I need would be <div id="slider-wrapper" class="someclass">

Zoom in with affinetransform swing

不打扰是莪最后的温柔 提交于 2019-12-07 19:39:39
问题 I'm working on my personal project using JAVA swing. The project is about drawing a map on a window. The map is zoomable using affinetransform. The problem I'm having here is whenever I zoom in or out the map also shifts instead of zooming in/out on the point of the map that is at the center of the screen private void updateAT() { Dimension d = panel.getSize(); int panelW = d.width; int panelH = d.height; Rectangle2D r = regionList[0].get("Victoria").getShape().getBounds2D(); scaleX = (panelW

How to get a logarithmic distribution from an interval

百般思念 提交于 2019-12-07 18:57:56
问题 I am currently trying to cut an interval into not equal-width slices. In fact I want the width of each slice to follow a logarithmic rule. For instance the first interval is supposed to be bigger than the second one, etc. I have a hard time remembering my mathematics lectures. So assuming I know a and b which are respectively the lower and upper boundaries of my interval I , and n is the number of slices: how can I find the lower and upper boundaries of each slice (following a logarithmic

Auto Scale TextView Text to Fit within Bounds in 4.0

痴心易碎 提交于 2019-12-07 17:12:22
问题 The solution Chase gave for this problem was working fine in 2.2 - 3.2 but when I tested it on 4.0 it failed. Here is the original post: Auto Scale TextView Text to Fit within Bounds On 4.0 I get a strange line spacing problem which brings me to something he/she wrote in his/her code: // Some devices try to auto adjust line spacing, so force default line spacing // and invalidate the layout as a side effect textPaint.setTextSize(targetTextSize); setLineSpacing(mSpacingAdd, mSpacingMult); I